20
« en: 10 de Marzo 2013, 16:56 »
Hola Cesar. El codigo de diseño es el siguiente:
private void initComponents() throws SQLException {
jButton1 = new javax.swing.JButton();
jButton2 = new javax.swing.JButton();
jButton3 = new javax.swing.JButton();
jButton4 = new javax.swing.JButton();
jButton5 = new javax.swing.JButton();
jButton6 = new javax.swing.JButton();
jButton7 = new javax.swing.JButton();
jTextField1 = new javax.swing.JTextField();
jTextField2 = new javax.swing.JTextField();
jTextField3 = new javax.swing.JTextField();
jTextField4 = new javax.swing.JTextField();
jTextField5 = new javax.swing.JTextField();
jTextField6 = new javax.swing.JTextField();
jTextField7 = new javax.swing.JTextField();
final JTabbedPane pestaña = new JTabbedPane();
pestaña.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(0, 0, 0), 3));
pestaña.setSize(720, 700);
pestaña.setLocation(290, 10);
JPanel panel = new JPanel(null);
Label label1 = new Label();
label1.setFont(new java.awt.Font("DejaVu Sans", 1, 24));
label1.setText("Nombre:");
label1.setBounds(20,30,200,20);
panel.add(label1);
jTextField1.setFont(new java.awt.Font("DejaVu Sans", 1, 18));
jTextField1.setText("");
jTextField1.setEditable(false);
jTextField1.setBounds(280,30,420,30);
panel.add(jTextField1);
Label label2 = new Label();
label2.setFont(new java.awt.Font("DejaVu Sans", 1, 24));
label2.setText("CI:");
label2.setBounds(20,70,200,20);
panel.add(label2);
jTextField2.setFont(new java.awt.Font("DejaVu Sans", 1, 18));
jTextField2.setText("");
jTextField2.setBounds(280,70,150,30);
jTextField2.setEditable(false);
panel.add(jTextField2);
Label label3 = new Label();
label3.setFont(new java.awt.Font("DejaVu Sans", 1, 24));
label3.setText("Edad:");
label3.setBounds(20,110,200,20);
panel.add(label3);
jTextField3.setFont(new java.awt.Font("DejaVu Sans", 1, 18));
jTextField3.setText("");
jTextField3.setBounds(280,110,50,30);
jTextField3.setEditable(false);
panel.add(jTextField3);
Label label4 = new Label();
label4.setFont(new java.awt.Font("DejaVu Sans", 1, 24));
label4.setText("Fecha de ingreso:");
label4.setBounds(20,150,250,30);
panel.add(label4);
jTextField4.setFont(new java.awt.Font("DejaVu Sans", 1, 18));
jTextField4.setText("");
jTextField4.setBounds(280,150,150,30);
jTextField4.setEditable(false);
panel.add(jTextField4);
Label label5 = new Label();
label5.setFont(new java.awt.Font("DejaVu Sans", 1, 24));
label5.setText("Ultima Consulta:");
label5.setBounds(20,190,250,30);
panel.add(label5);
jTextField5.setFont(new java.awt.Font("DejaVu Sans", 1, 18));
jTextField5.setText("");
jTextField5.setBounds(280,190,150,30);
jTextField5.setEditable(false);
panel.add(jTextField5);
final Label label6 = new Label();
label6.setFont(new java.awt.Font("DejaVu Sans", 1, 24));
label6.setText("Proxima Consulta:");
label6.setBounds(20,230,250,30);
panel.add(label6);
jTextField6.setFont(new java.awt.Font("DejaVu Sans", 1, 18));
jTextField6.setText("");
jTextField6.setBounds(280,230,150,30);
panel.add(jTextField6);
jTextField7.setFont(new java.awt.Font("DejaVu Sans", 1, 18));
jTextField7.setText("");
jTextField7.setBounds(480,230,150,30);
jTextField7.addActionListener(new java.awt.event.ActionListener() {
@Override
public void actionPerformed(java.awt.event.ActionEvent evt) {
jTextField7ActionPerformed(evt);
}
public void jTextField7ActionPerformed(ActionEvent evt) {
label6.setText(jTextField7.getText().toString());
}
});
panel.add(jTextField7);
jButton1.setFont(new java.awt.Font("DejaVu Sans", 1, 18));
jButton1.setText("Nuevo Paciente");
jButton1.setBounds(20,300,200,30);
jButton1.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
try {
jButton1ActionPerformed(evt);
} catch (Exception ex){
}
}
private void jButton1ActionPerformed(ActionEvent evt) {
jButton3.setEnabled(true);
jTextField1.setEditable(true);
jTextField2.setEditable(true);
jTextField3.setEditable(true);
jTextField4.setEditable(true);
fechahoy();
}
});
panel.add(jButton1);
jButton6.setFont(new java.awt.Font("DejaVu Sans", 1, 18));
jButton6.setText("Nueva consulta");
jButton6.setBounds(240,300,200,30);
jButton6.addActionListener(new java.awt.event.ActionListener() {
@Override
public void actionPerformed(ActionEvent ae) {
if (pestaña.getTabCount()==1){
final JPanel panel1 = new JPanel();
panel1.setLayout(null);
panel1.setBorder(BorderFactory.createTitledBorder(""));
panel1.setBackground( Color.YELLOW );
Evaluacion ev = new Evaluacion();
ev.DiseñarPanel1(panel1);
pestaña.addTab("Evaluacion clinica", panel1);
final JPanel panel2 = new JPanel();
panel2.setLayout(null);
panel2.setBorder(BorderFactory.createTitledBorder(""));
panel2.setBackground( Color.YELLOW );
Paraclinicos pc = new Paraclinicos();
pc.DiseñarPanel2(panel2);
pestaña.addTab("Paraclínicos", panel2);
final JPanel panel3 = new JPanel();
panel3.setLayout(null);
panel3.setBorder(BorderFactory.createTitledBorder(""));
panel3.setBackground( Color.YELLOW );
Diagnosticos dx = new Diagnosticos();
dx.DiseñarPanel3(panel3);
pestaña.addTab("Diagnósticos", panel3);
final JPanel panel4 = new JPanel();
panel4.setLayout(null);
panel4.setBorder(BorderFactory.createTitledBorder(""));
panel4.setBackground( Color.YELLOW );
Tratamiento tx = new Tratamiento();
tx.DiseñarPanel4(panel4);
pestaña.addTab("Tratamiento", panel4);
final JPanel panel5 = new JPanel();
panel5.setLayout(null);
panel5.setBorder(BorderFactory.createTitledBorder(""));
panel5.setBackground( Color.YELLOW );
Solicitudes sx = new Solicitudes();
sx.DiseñarPanel5(panel5);
pestaña.addTab("Solicitudes", panel5);
jButton6.setEnabled(false);
}
}
});
panel.add(jButton6);
jButton2.setFont(new java.awt.Font("DejaVu Sans", 1, 18));
jButton2.setText("Editar Paciente");
jButton2.setBounds(460,300,200,30);
panel.add(jButton2);
jButton3.setFont(new java.awt.Font("DejaVu Sans", 1, 18));
jButton3.setText("Guardar Paciente");
jButton3.setEnabled(false);
jButton3.setBounds(50,400,230,30);
jButton3.addActionListener(new java.awt.event.ActionListener() {
@Override
public void actionPerformed(java.awt.event.ActionEvent evt) {
try {
jButton3ActionPerformed(evt);
} catch (Exception ex){
}
}
public void jButton3ActionPerformed(ActionEvent evt) {
guardar();
}
});
panel.add(jButton3);
jButton4.setFont(new java.awt.Font("DejaVu Sans", 1, 18));
jButton4.setText("Eliminar Paciente");
jButton4.setBounds(420,400,230,30);
panel.add(jButton4);
jButton5.setFont(new java.awt.Font("DejaVu Sans", 1, 18));
jButton5.setText("Cancelar");
jButton5.setEnabled(false);
jButton5.setBounds(280,350,140,30);
panel.add(jButton5);
jButton7.setFont(new java.awt.Font("DejaVu Sans", 1, 18));
jButton7.setText("Prueba");
jButton7.setEnabled(true);
jButton7.setBounds(280,450,140,30);
jButton7.addActionListener(new java.awt.event.ActionListener() {
@Override
public void actionPerformed(ActionEvent ae) {
}
});
panel.add(jButton7);
pestaña.addTab("Datos del paciente", panel);
getContentPane().add(pestaña);
choice1 = new JComboBox();
choice1.setModel(new DefaultComboBoxModel(new String[] {}));
Font f;
f = new Font ("Helvetica", 1, 15);
choice1.setFont(f);
choice1.setSize(250, 30);
choice1.setLocation(10, 300);
add(choice1);
setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
getContentPane().setLayout(layout);
layout.setHorizontalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGap(0, 1100, Short.MAX_VALUE)
);
layout.setVerticalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGap(0, 1000, Short.MAX_VALUE)
);
pack();
ActionListener actionListener = new ActionListener() {
@Override
public void actionPerformed(ActionEvent actionEvent) {
jButton6.setEnabled(true);
int entero;
entero = choice1.getSelectedIndex();
String texto = Integer.toString(entero);
cargarpaciente();
borrar_paneles();
a1 = jTextField7.getText();
}
};
choice1.addActionListener(actionListener);
}