Estou com um problema, pois estou montando um sistema com varias janelas.
Indicaram-me por todas abrindo em uma única tela, ou seja, eu teria um único Layout
Com os menus que iria necessita.
Mas eu não sei como eu poderia estar fazendo isso alguém pode me ajudar?
esttá ai em baixo a minha tela inicial.
import javax.swing.*;
/*
* Tela_Inicial.java
*
* Created on 27 de Novembro de 2008, 21:04
*/
/**
*
* @author aluno
*/
public class Tela_Inicial extends javax.swing.JFrame {
/** Creates new form Tela_Inicial */
public Tela_Inicial() {
initComponents();
setExtendedState(JFrame.MAXIMIZED_BOTH);
}
/** 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.
*/
@SuppressWarnings("unchecked")
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
private void initComponents() {
jPanel1 = new javax.swing.JPanel();
jMenuBar1 = new javax.swing.JMenuBar();
jMenu1 = new javax.swing.JMenu();
cadastrar = new javax.swing.JMenu();
medico = new javax.swing.JMenuItem();
paciente = new javax.swing.JMenuItem();
enfermeiro = new javax.swing.JMenuItem();
agendamento = new javax.swing.JMenu();
consulta = new javax.swing.JMenuItem();
pesquisa = new javax.swing.JMenu();
relatorio = new javax.swing.JMenu();
setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
setTitle(" Seja Bem Vindo !");
jPanel1.setBorder(javax.swing.BorderFactory.createEtchedBorder());
javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1);
jPanel1.setLayout(jPanel1Layout);
jPanel1Layout.setHorizontalGroup(
jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGap(0, 398, Short.MAX_VALUE)
);
jPanel1Layout.setVerticalGroup(
jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGap(0, 312, Short.MAX_VALUE)
);
jMenu1.setText("Administração");
jMenu1.setFont(new java.awt.Font("Times New Roman", 1, 14));
cadastrar.setText("Cadastrar");
cadastrar.setFont(new java.awt.Font("Times New Roman", 1, 14));
medico.setFont(new java.awt.Font("Times New Roman", 1, 14)); // NOI18N
medico.setText("Medico");
medico.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
medicoActionPerformed(evt);
}
});
cadastrar.add(medico);
paciente.setFont(new java.awt.Font("Times New Roman", 1, 14)); // NOI18N
paciente.setText("Paciente");
paciente.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
pacienteActionPerformed(evt);
}
});
cadastrar.add(paciente);
enfermeiro.setFont(new java.awt.Font("Times New Roman", 1, 14)); // NOI18N
enfermeiro.setText("Enfermeiro");
enfermeiro.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
enfermeiroActionPerformed(evt);
}
});
cadastrar.add(enfermeiro);
jMenu1.add(cadastrar);
jMenuBar1.add(jMenu1);
agendamento.setText("Agendamento");
agendamento.setFont(new java.awt.Font("Times New Roman", 1, 14));
consulta.setFont(new java.awt.Font("Times New Roman", 1, 14));
consulta.setText("Consulta");
agendamento.add(consulta);
jMenuBar1.add(agendamento);
pesquisa.setText("Pesquisar");
pesquisa.setFont(new java.awt.Font("Times New Roman", 1, 14));
pesquisa.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
pesquisaActionPerformed(evt);
}
});
jMenuBar1.add(pesquisa);
relatorio.setText("Relatorio");
relatorio.setFont(new java.awt.Font("Times New Roman", 1, 14));
relatorio.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
relatorioActionPerformed(evt);
}
});
jMenuBar1.add(relatorio);
setJMenuBar(jMenuBar1);
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
getContentPane().setLayout(layout);
layout.setHorizontalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addContainerGap()
.addComponent(jPanel1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addContainerGap())
);
layout.setVerticalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addContainerGap()
.addComponent(jPanel1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
);
pack();
}// </editor-fold>//GEN-END:initComponents
private void pesquisaActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_pesquisaActionPerformed
// TODO add your handling code here:
new Pesquisar();
}//GEN-LAST:event_pesquisaActionPerformed
private void medicoActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_medicoActionPerformed
// TODO add your handling code here:
new Cadastrar_Medico();
}//GEN-LAST:event_medicoActionPerformed
private void pacienteActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_pacienteActionPerformed
// TODO add your handling code here:
new Cadastrar_Paciente();
}//GEN-LAST:event_pacienteActionPerformed
private void enfermeiroActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_enfermeiroActionPerformed
// TODO add your handling code here:
new Cadastrar_Enfermeiro();
}//GEN-LAST:event_enfermeiroActionPerformed
private void relatorioActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_relatorioActionPerformed
// TODO add your handling code here:
new Relatorio();
}//GEN-LAST:event_relatorioActionPerformed
/**
* @param args the command line arguments
*/
public static void main(String args[]) {
java.awt.EventQueue.invokeLater(new Runnable() {
public void run() {
new Tela_Inicial().setVisible(true);
new Login();
}
});
}
// Variables declaration - do not modify//GEN-BEGIN:variables
private javax.swing.JMenu agendamento;
private javax.swing.JMenu cadastrar;
private javax.swing.JMenuItem consulta;
private javax.swing.JMenuItem enfermeiro;
private javax.swing.JMenu jMenu1;
private javax.swing.JMenuBar jMenuBar1;
private javax.swing.JPanel jPanel1;
private javax.swing.JMenuItem medico;
private javax.swing.JMenuItem paciente;
private javax.swing.JMenu pesquisa;
private javax.swing.JMenu relatorio;
// End of variables declaration//GEN-END:variables
}