Dear all,
I'm newbie in Java language. I get assingment from my teacher to create small project for my final test.

Now, I create a Budget Controlling project using Netbeans.
I have created main class, Login form, menu and MasterBudgetingGroup (addGroupAnggaran).

In menu, I have menuItem. But when I click it, it does not open MasterBudgetingGroup

private void mnMasterGroupAnggaranActionPerformed(java.awt.event.ActionEvent evt) {
addGroupAnggaran frm = new addGroupAnggaran();
jd.add(frm);
frm.show();
}

jd is JdesktopPane.

this is code of masterBudgetingGroup :

public class addGroupAnggaran extends javax.swing.JPanel {


/** Creates new form addSubAnggaran */
public addGroupAnggaran() {
initComponents();
}


/** This method is called from within the constructor to
* initialize the form.
* WARNING: Do NOT modify this code. The content of this method is
* always regenerated by the Form Editor.
*/
// <editor-fold defaultstate="collapsed" desc="Generated Code">
private void initComponents() {


txtKodeSubAnggaran = new javax.swing.JTextField();
jLabel2 = new javax.swing.JLabel();
txtNamaSubAnggaran = new javax.swing.JTextField();
cmdNew = new javax.swing.JButton();
cmdEdit = new javax.swing.JButton();
cmdSave = new javax.swing.JButton();
cmdCancel = new javax.swing.JButton();
cmdDelete = new javax.swing.JButton();
cmdExit = new javax.swing.JButton();


jLabel2.setText("Nama Group Anggaran");


cmdNew.setText("Tambah");


cmdEdit.setText("Rubah");


cmdSave.setText("Simpan");


cmdCancel.setText("Batal");


cmdDelete.setText("Hapus");


cmdExit.setText("Keluar");
cmdExit.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
cmdExitActionPerformed(evt);
}
});


org.jdesktop.layout.GroupLayout layout = new org.jdesktop.layout.GroupLayout(this);
this.setLayout(layout);
layout.setHorizontalGroup(
layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
.add(layout.createSequentialGroup()
.add(138, 138, 138)
.add(txtKodeSubAnggaran, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 84, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
.add(layout.createSequentialGroup()
.add(jLabel2, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 134, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
.add(txtNamaSubAnggaran, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 290, Short.MAX_VALUE))
.add(layout.createSequentialGroup()
.add(cmdNew)
.addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
.add(cmdEdit)
.addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
.add(cmdSave)
.addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
.add(cmdCancel)
.addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
.add(cmdDelete)
.addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
.add(cmdExit))
);
layout.setVerticalGroup(
layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
.add(org.jdesktop.layout.GroupLayout.TRAILING, layout.createSequentialGroup()
.addContainerGap(org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.add(txtKodeSubAnggaran, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
.add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
.add(jLabel2)
.add(txtNamaSubAnggaran, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
.addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
.add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
.add(cmdNew)
.add(cmdEdit)
.add(cmdSave)
.add(cmdCancel)
.add(cmdDelete)
.add(cmdExit))
.add(522, 522, 522))
);
}// </editor-fold>


private void cmdExitActionPerformed(java.awt.event.ActionEvent evt) {
// TODO add your handling code here:
setVisible(false);
}



// Variables declaration - do not modify
private javax.swing.JButton cmdCancel;
private javax.swing.JButton cmdDelete;
private javax.swing.JButton cmdEdit;
private javax.swing.JButton cmdExit;
private javax.swing.JButton cmdNew;
private javax.swing.JButton cmdSave;
private javax.swing.JLabel jLabel2;
private javax.swing.JTextField txtKodeSubAnggaran;
private javax.swing.JTextField txtNamaSubAnggaran;
// End of variables declaration


}

Please help me, because I can not start to next forms.

Thanks,

Kusno

There is no "menu" anywhere in that code. A bunch of Buttons, but no menu, so what exactly is your problem?

There is no "menu" anywhere in that code. A bunch of Buttons, but no menu, so what exactly is your problem?

Sorry the code above is for addGroupAnggaran.

This is the code menu :

import javax.swing.JOptionPane;
import javax.swing.*;


/*
* MenuUtama.java
*
* Created on April 7, 2008, 5:12 PM
*/


/**
*
* @author  kusno
*/
public class MenuUtama extends javax.swing.JFrame {


/** Creates new form MenuUtama */
public MenuUtama() {
initComponents();
}


/** This method is called from within the constructor to
* initialize the form.
* WARNING: Do NOT modify this code. The content of this method is
* always regenerated by the Form Editor.
*/
// <editor-fold defaultstate="collapsed" desc="Generated Code">
private void initComponents() {


jd = new javax.swing.JDesktopPane();
jMenuBar1 = new javax.swing.JMenuBar();
mnDataUtama = new javax.swing.JMenu();
mnMasterGroupAnggaran = new javax.swing.JMenuItem();
mnMasterDetailAnggaran = new javax.swing.JMenuItem();
mnTransaksi = new javax.swing.JMenu();
mnTransaksiSaldoAwal = new javax.swing.JMenuItem();
mnTransaksiPemakaianAnggaran = new javax.swing.JMenuItem();
mnTransaksiTransferAnggaran = new javax.swing.JMenuItem();
mnLaporan = new javax.swing.JMenu();
mnLaporanMasterlAnggaran = new javax.swing.JMenuItem();
mnLaporanPemakaianAnggaran = new javax.swing.JMenuItem();
mnLaporanAnggaranKeluar = new javax.swing.JMenuItem();
mnLaporanTransferAnggaran = new javax.swing.JMenuItem();
mnUser = new javax.swing.JMenu();
mnMasterUser = new javax.swing.JMenuItem();
mnAkses = new javax.swing.JMenuItem();
mnKeluar = new javax.swing.JMenu();


setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
setTitle("Indonusa Esa Unggul");


jd.setAutoscrolls(true);


mnDataUtama.setText("Data Utama");


mnMasterGroupAnggaran.setText("Group Anggaran");
mnMasterGroupAnggaran.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
mnMasterGroupAnggaranActionPerformed(evt);
}
});
mnDataUtama.add(mnMasterGroupAnggaran);


mnMasterDetailAnggaran.setText("Detail Anggaran");
mnDataUtama.add(mnMasterDetailAnggaran);


jMenuBar1.add(mnDataUtama);


mnTransaksi.setText("Transaksi");


mnTransaksiSaldoAwal.setText("Saldo awal");
mnTransaksi.add(mnTransaksiSaldoAwal);


mnTransaksiPemakaianAnggaran.setText("Pemakaian Anggaran");
mnTransaksi.add(mnTransaksiPemakaianAnggaran);


mnTransaksiTransferAnggaran.setText("Transfer Anggaran");
mnTransaksi.add(mnTransaksiTransferAnggaran);


jMenuBar1.add(mnTransaksi);


mnLaporan.setText("Laporan");


mnLaporanMasterlAnggaran.setText("Detail Anggaran");
mnLaporan.add(mnLaporanMasterlAnggaran);


mnLaporanPemakaianAnggaran.setText("Pemakaian Anggaran");
mnLaporan.add(mnLaporanPemakaianAnggaran);


mnLaporanAnggaranKeluar.setText("Anggaran Keluar");
mnLaporan.add(mnLaporanAnggaranKeluar);


mnLaporanTransferAnggaran.setText("Transfer Anggaran");
mnLaporan.add(mnLaporanTransferAnggaran);


jMenuBar1.add(mnLaporan);


mnUser.setText("Pengaturan User");


mnMasterUser.setText("User");
mnMasterUser.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
mnMasterUserActionPerformed(evt);
}
});
mnUser.add(mnMasterUser);


mnAkses.setText("Akses Penguna");
mnUser.add(mnAkses);


jMenuBar1.add(mnUser);


mnKeluar.setText("Keluar");
mnKeluar.addMouseListener(new java.awt.event.MouseAdapter() {
public void mouseClicked(java.awt.event.MouseEvent evt) {
mnKeluarMouseClicked(evt);
}
});
jMenuBar1.add(mnKeluar);


setJMenuBar(jMenuBar1);


org.jdesktop.layout.GroupLayout layout = new org.jdesktop.layout.GroupLayout(getContentPane());
getContentPane().setLayout(layout);
layout.setHorizontalGroup(
layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
.add(jd, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 400, Short.MAX_VALUE)
);
layout.setVerticalGroup(
layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
.add(jd, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 279, Short.MAX_VALUE)
);


pack();
}// </editor-fold>


private void mnMasterUserActionPerformed(java.awt.event.ActionEvent evt) {
// TODO add your handling code here:
}


private void mnKeluarMouseClicked(java.awt.event.MouseEvent evt) {
// TODO add your handling code here:
int reply=JOptionPane.showConfirmDialog(this,"Ingin keluar ?","Sistem Anggaran",JOptionPane.YES_NO_OPTION,JOptionPane.PLAIN_MESSAGE);
if(reply==JOptionPane.YES_OPTION)
{
setVisible(false);
dispose();
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
System.exit(0);
}
}


private void mnMasterGroupAnggaranActionPerformed(java.awt.event.ActionEvent evt) {
System.out.println("test");
addGroupAnggaran frm = new addGroupAnggaran();
jd.add(frm);
frm.show();
}


/**
* @param args the command line arguments
*/
//    public static void main(String args[]) {
//        java.awt.EventQueue.invokeLater(new Runnable() {
//            public void run() {
//                new MenuUtama().setVisible(true);
//            }
//        });
//    }


// Variables declaration - do not modify
private javax.swing.JMenuBar jMenuBar1;
private javax.swing.JDesktopPane jd;
private javax.swing.JMenuItem mnAkses;
private javax.swing.JMenu mnDataUtama;
private javax.swing.JMenu mnKeluar;
private javax.swing.JMenu mnLaporan;
private javax.swing.JMenuItem mnLaporanAnggaranKeluar;
private javax.swing.JMenuItem mnLaporanMasterlAnggaran;
private javax.swing.JMenuItem mnLaporanPemakaianAnggaran;
private javax.swing.JMenuItem mnLaporanTransferAnggaran;
private javax.swing.JMenuItem mnMasterDetailAnggaran;
private javax.swing.JMenuItem mnMasterGroupAnggaran;
private javax.swing.JMenuItem mnMasterUser;
private javax.swing.JMenu mnTransaksi;
private javax.swing.JMenuItem mnTransaksiPemakaianAnggaran;
private javax.swing.JMenuItem mnTransaksiSaldoAwal;
private javax.swing.JMenuItem mnTransaksiTransferAnggaran;
private javax.swing.JMenu mnUser;
// End of variables declaration


}

You have no MenuItemListener

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.