Meu querido... Isso ai que vc me ensinou eu já consegui fazer...
Acho que não me expressei bem então
Segue o meu código:
public class TelaPrincipal extends javax.swing.JFrame {
/** Criacao do formulario da TelaPrincipal */
public TelaPrincipal() {
super("Sistema Gerenciador de Empregados");
initComponents();
}
@SuppressWarnings("unchecked")
// <editor-fold defaultstate="collapsed" desc="Generated Code">
private void initComponents() {
jPanel1 = new javax.swing.JPanel();
sair = new java.awt.Button();
jMenuBar1 = new javax.swing.JMenuBar();
jMenu1 = new javax.swing.JMenu();
novoCadastro = new javax.swing.JMenuItem();
editarCadastro = new javax.swing.JMenuItem();
jMenu3 = new javax.swing.JMenu();
jMenuItem5 = new javax.swing.JMenuItem();
jMenuItem6 = new javax.swing.JMenuItem();
jMenu2 = new javax.swing.JMenu();
jMenuItem3 = new javax.swing.JMenuItem();
jMenuItem4 = new javax.swing.JMenuItem();
setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
setBackground(new java.awt.Color(153, 255, 255));
setIconImages(null);
setLocationByPlatform(true);
jPanel1.setBackground(new java.awt.Color(202, 219, 254));
jPanel1.setBorder(new javax.swing.border.SoftBevelBorder(javax.swing.border.BevelBorder.RAISED));
jPanel1.setForeground(new java.awt.Color(153, 153, 153));
sair.setActionCommand("SAIR");
sair.setBackground(new java.awt.Color(255, 255, 255));
sair.setForeground(new java.awt.Color(255, 0, 0));
sair.setLabel("SAIR");
sair.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
sairActionPerformed(evt);
}
});
org.jdesktop.layout.GroupLayout jPanel1Layout = new org.jdesktop.layout.GroupLayout(jPanel1);
jPanel1.setLayout(jPanel1Layout);
jPanel1Layout.setHorizontalGroup(
jPanel1Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
.add(org.jdesktop.layout.GroupLayout.TRAILING, jPanel1Layout.createSequentialGroup()
.addContainerGap(326, Short.MAX_VALUE)
.add(sair, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
.add(25, 25, 25))
);
jPanel1Layout.setVerticalGroup(
jPanel1Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
.add(jPanel1Layout.createSequentialGroup()
.addContainerGap()
.add(sair, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
.addContainerGap(240, Short.MAX_VALUE))
);
sair.getAccessibleContext().setAccessibleName("sair");
jMenuBar1.setBackground(new java.awt.Color(80, 96, 142));
jMenuBar1.setBorder(new javax.swing.border.SoftBevelBorder(javax.swing.border.BevelBorder.RAISED));
jMenu1.setBackground(new java.awt.Color(80, 96, 142));
jMenu1.setText("Cadastro");
novoCadastro.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_N, java.awt.event.InputEvent.CTRL_MASK));
novoCadastro.setText("Novo Cadastro");
novoCadastro.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
novoCadastroActionPerformed(evt);
}
});
jMenu1.add(novoCadastro);
editarCadastro.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_E, java.awt.event.InputEvent.CTRL_MASK));
editarCadastro.setText("Editar Cadastro");
editarCadastro.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
editarCadastroActionPerformed(evt);
}
});
jMenu1.add(editarCadastro);
jMenuBar1.add(jMenu1);
jMenu3.setBackground(new java.awt.Color(80, 96, 142));
jMenu3.setText("Editar");
jMenuItem5.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_T, java.awt.event.InputEvent.ALT_MASK));
jMenuItem5.setText("Tabela");
jMenu3.add(jMenuItem5);
jMenuItem6.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_E, java.awt.event.InputEvent.ALT_MASK));
jMenuItem6.setText("Editar registro");
jMenu3.add(jMenuItem6);
jMenuBar1.add(jMenu3);
jMenu2.setBackground(new java.awt.Color(80, 96, 142));
jMenu2.setText("Consulta");
jMenu2.setFont(new java.awt.Font("Tahoma", 1, 11));
jMenu2.setHideActionText(true);
jMenuItem3.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_N, java.awt.event.InputEvent.ALT_MASK));
jMenuItem3.setText("Por Nome");
jMenu2.add(jMenuItem3);
jMenuItem4.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_L, java.awt.event.InputEvent.ALT_MASK));
jMenuItem4.setText("Listar Todos");
jMenu2.add(jMenuItem4);
jMenuBar1.add(jMenu2);
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(jPanel1, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
);
layout.setVerticalGroup(
layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
.add(org.jdesktop.layout.GroupLayout.TRAILING, jPanel1, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
);
pack();
}// </editor-fold>
private void novoCadastroActionPerformed(java.awt.event.ActionEvent evt) {
new TelaCadastro( ).setVisible(true);
}
private void sairActionPerformed(java.awt.event.ActionEvent evt) {
System.exit(0);
}
private void editarCadastroActionPerformed(java.awt.event.ActionEvent evt) {
}
o grande problema é a função do botão... chamada dele.
Eu sei que vou ter que realizar uma consulta no Banco, mas como eu vou fazer isso aparecer na interface eh que eu nao sei... eu ja tentei setar os campos
mas nao deu certo.