Hola mis estimados amigos y compañeros de youtube xD... no era broma seria mejor con la voz de jorge loquendo xD, en esta ocasión necesito una ayudita de los mas experimentados en java estoy realizando un proyecto de practica, se trata de un sistema para llevar registro de pacientes, la funcionalidad que deseo atribuirle al sistema es muy simple 1ro que el usuario pueda digitar dentro componentes de la clase jTextArea y otros componentes jTextField y al darle click al boton "Guardar" que lo guarde 2do posterior a eso en caso que el usuario desee consultar los datos previamente guardados que digite el nombre del paciente y al darle click al boton "Buscar" muestre todos los datos relacionados con ese paciente en los componentes de la clase jTextArea y al mismo tiempo en un componente jTable este ultimo ya logre hacer conseguir sincronizar con los datos del jTextArea es lo que todavia no pude lograr hacer...a continuacion pego dos links para que vean las imagenes del "layout" del formulario (JFrame Form)
Codigo del modulo NuevoRegistroClinico _________________________________________________________ /* * NuevoRegistroClinico.java * * Created on 10 de marzo de 2015, 16:56 */
package hosipital;
/** * * @author Administrador */ public class NuevoRegistroClinico extends javax.swing.JFrame {
/** Creates new form NuevoRegistroClinico */ public NuevoRegistroClinico() { 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() { jLabel4 = new javax.swing.JLabel(); jLabel8 = new javax.swing.JLabel(); jLabel7 = new javax.swing.JLabel(); jLabel9 = new javax.swing.JLabel(); jLabel6 = new javax.swing.JLabel(); jScrollPane3 = new javax.swing.JScrollPane(); jTextArea2 = new javax.swing.JTextArea(); jScrollPane2 = new javax.swing.JScrollPane(); jTextArea1 = new javax.swing.JTextArea(); jScrollPane4 = new javax.swing.JScrollPane(); jTextArea3 = new javax.swing.JTextArea(); jTextField2 = new javax.swing.JTextField(); jScrollPane5 = new javax.swing.JScrollPane(); jTextArea4 = new javax.swing.JTextArea(); jLabel1 = new javax.swing.JLabel(); jLabel2 = new javax.swing.JLabel(); jLabel3 = new javax.swing.JLabel(); jTextField1 = new javax.swing.JTextField(); jTextField3 = new javax.swing.JTextField(); jLabel5 = new javax.swing.JLabel(); jTextField4 = new javax.swing.JTextField(); jLabel10 = new javax.swing.JLabel(); jTextField5 = new javax.swing.JTextField(); jLabel11 = new javax.swing.JLabel(); jTextField6 = new javax.swing.JTextField(); jLabel12 = new javax.swing.JLabel(); jTextField7 = new javax.swing.JTextField(); jSeparator1 = new javax.swing.JSeparator(); jTextField8 = new javax.swing.JTextField(); jSeparator2 = new javax.swing.JSeparator(); jButton1 = new javax.swing.JButton(); jButton2 = new javax.swing.JButton();
setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE); setTitle("Registro Clinico Paciente"); jLabel4.setText("Fecha de Consulta:");
public class ConsultaRegistroClinico extends javax.swing.JFrame { int navega = 0; conexion con_people; int inicia_combo = 0; String ordenacao = "nombre";
public ConsultaRegistroClinico() { initComponents(); con_people = new conexion(); con_people.conecta(); con_people.executeSQL("select * from people order by "+ordenacao);
// <editor-fold defaultstate="collapsed" desc=" Generated Code "> private void initComponents() { jPanel1 = new javax.swing.JPanel(); jTextField2 = new javax.swing.JTextField(); jLabel1 = new javax.swing.JLabel(); jTextField3 = new javax.swing.JTextField(); jLabel2 = new javax.swing.JLabel(); jButton1 = new javax.swing.JButton(); jPanel2 = new javax.swing.JPanel(); jLabel3 = new javax.swing.JLabel(); jLabel6 = new javax.swing.JLabel(); jLabel7 = new javax.swing.JLabel(); jLabel8 = new javax.swing.JLabel(); jPanel5 = new javax.swing.JPanel(); jScrollPane4 = new javax.swing.JScrollPane(); jTextArea3 = new javax.swing.JTextArea(); jLabel9 = new javax.swing.JLabel(); jLabel5 = new javax.swing.JLabel(); jScrollPane2 = new javax.swing.JScrollPane(); jTextArea1 = new javax.swing.JTextArea(); jScrollPane3 = new javax.swing.JScrollPane(); jTextArea2 = new javax.swing.JTextArea(); jScrollPane5 = new javax.swing.JScrollPane(); jTextArea4 = new javax.swing.JTextArea(); jScrollPane1 = new javax.swing.JScrollPane(); jTable1 = new javax.swing.JTable();
catch(SQLException erro) { if (navega == 1) JOptionPane.showMessageDialog(null,"Olha, você já está no primeiro registro");
else if (navega == 2) JOptionPane.showMessageDialog(null,"Olha, você já está no último registro"); else JOptionPane.showMessageDialog(null,"Não localizou dados "+erro);
navega=0; } }
public void preencher_jtable() { jTable1.getColumnModel().getColumn(0).setPreferredWidth(20); jTable1.getColumnModel().getColumn(1).setPreferredWidth(150); jTable1.getColumnModel().getColumn(2).setPreferredWidth(20);
catch (SQLException erro) { JOptionPane.showMessageDialog(null,"Erro ao listar no JTable "+erro); } }
public void ordem_visualizacao(String Ordem) { ordenacao = Ordem; con_people.executeSQL("select * from people order by "+ordenacao); preencher_jtable();
try { con_people.resultset.first(); }
catch (SQLException erro) { JOptionPane.showMessageDialog(null,"Erro na ordenação dos dados "+erro); }
mostrar_dados();
}
}// FIN CLASE %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
para contactarme directamente aqui mi facebook --- https://www.facebook.com/chris.mcgraw.92
Hola mis estimados amigos y compañeros de youtube xD... no era broma seria mejor con la voz de jorge loquendo xD, en esta ocasión necesito una ayudita de los mas experimentados en java estoy realizando un proyecto de practica, se trata de un sistema para llevar registro de pacientes, la funcionalidad que deseo atribuirle al sistema es muy simple 1ro que el usuario pueda digitar dentro componentes de la clase jTextArea y otros componentes jTextField y al darle click al boton "Guardar" que lo guarde 2do posterior a eso en caso que el usuario desee consultar los datos previamente guardados que digite el nombre del paciente y al darle click al boton "Buscar" muestre todos los datos relacionados con ese paciente en los componentes de la clase jTextArea y al mismo tiempo en un componente jTable este ultimo ya logre hacer conseguir sincronizar con los datos del jTextArea es lo que todavia no pude lograr hacer...a continuacion pego dos links para que vean las imagenes del "layout" del formulario (JFrame Form)
http://imageshack.com/a/img661/834/6ocSFZ.png
http://imageshack.com/a/img538/7732/gcawW0.png
Y abajo estan los codigos fuentes
Codigo del modulo NuevoRegistroClinico
_________________________________________________________
/*
* NuevoRegistroClinico.java
*
* Created on 10 de marzo de 2015, 16:56
*/
package hosipital;
/**
*
* @author Administrador
*/
public class NuevoRegistroClinico extends javax.swing.JFrame {
/** Creates new form NuevoRegistroClinico */
public NuevoRegistroClinico() {
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() {
jLabel4 = new javax.swing.JLabel();
jLabel8 = new javax.swing.JLabel();
jLabel7 = new javax.swing.JLabel();
jLabel9 = new javax.swing.JLabel();
jLabel6 = new javax.swing.JLabel();
jScrollPane3 = new javax.swing.JScrollPane();
jTextArea2 = new javax.swing.JTextArea();
jScrollPane2 = new javax.swing.JScrollPane();
jTextArea1 = new javax.swing.JTextArea();
jScrollPane4 = new javax.swing.JScrollPane();
jTextArea3 = new javax.swing.JTextArea();
jTextField2 = new javax.swing.JTextField();
jScrollPane5 = new javax.swing.JScrollPane();
jTextArea4 = new javax.swing.JTextArea();
jLabel1 = new javax.swing.JLabel();
jLabel2 = new javax.swing.JLabel();
jLabel3 = new javax.swing.JLabel();
jTextField1 = new javax.swing.JTextField();
jTextField3 = new javax.swing.JTextField();
jLabel5 = new javax.swing.JLabel();
jTextField4 = new javax.swing.JTextField();
jLabel10 = new javax.swing.JLabel();
jTextField5 = new javax.swing.JTextField();
jLabel11 = new javax.swing.JLabel();
jTextField6 = new javax.swing.JTextField();
jLabel12 = new javax.swing.JLabel();
jTextField7 = new javax.swing.JTextField();
jSeparator1 = new javax.swing.JSeparator();
jTextField8 = new javax.swing.JTextField();
jSeparator2 = new javax.swing.JSeparator();
jButton1 = new javax.swing.JButton();
jButton2 = new javax.swing.JButton();
setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
setTitle("Registro Clinico Paciente");
jLabel4.setText("Fecha de Consulta:");
jLabel8.setText("Diagnostico:");
jLabel7.setText("Procedimiento:");
jLabel9.setText("Indicaciones:");
jLabel6.setText("Sintomas:");
jTextArea2.setColumns(20);
jTextArea2.setRows(5);
jScrollPane3.setViewportView(jTextArea2);
jTextArea1.setColumns(20);
jTextArea1.setRows(5);
jScrollPane2.setViewportView(jTextArea1);
jTextArea3.setColumns(20);
jTextArea3.setRows(5);
jScrollPane4.setViewportView(jTextArea3);
jTextField2.setText(" ");
jTextArea4.setColumns(20);
jTextArea4.setRows(5);
jScrollPane5.setViewportView(jTextArea4);
jLabel1.setText("Nombre:");
jLabel2.setText("Apellido:");
jLabel3.setText("Edad:");
jTextField1.setText(" ");
jTextField3.setText(" ");
jLabel5.setText("Genero:");
jTextField4.setText(" ");
jLabel10.setText("Estatura:");
jTextField5.setText(" ");
jLabel11.setText("Peso:");
jTextField6.setText(" ");
jLabel12.setText("Tipo Sanguineo:");
jTextField7.setText(" ");
jSeparator1.setOrientation(javax.swing.SwingConstants.VERTICAL);
jTextField8.setText(" ");
jButton1.setText("Guardar");
jButton2.setText("Nuevo");
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()
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
.addGroup(layout.createSequentialGroup()
.addComponent(jButton2)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(jButton1))
.addGroup(layout.createSequentialGroup()
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
.addComponent(jLabel1)
.addComponent(jLabel2)
.addGroup(layout.createSequentialGroup()
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
.addComponent(jLabel10)
.addComponent(jLabel5)
.addComponent(jLabel11)
.addComponent(jLabel12)
.addComponent(jLabel3))
.addGap(6, 6, 6))
.addComponent(jLabel4))
.addGap(16, 16, 16)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
.addComponent(jTextField8)
.addComponent(jTextField7)
.addComponent(jTextField6)
.addComponent(jTextField4)
.addComponent(jTextField1, javax.swing.GroupLayout.Alignment.TRAILING)
.addComponent(jTextField2, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, 70, Short.MAX_VALUE)
.addComponent(jTextField3)
.addComponent(jTextField5)))
.addComponent(jSeparator2, javax.swing.GroupLayout.PREFERRED_SIZE, 186, javax.swing.GroupLayout.PREFERRED_SIZE))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(jSeparator1, javax.swing.GroupLayout.PREFERRED_SIZE, 10, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
.addComponent(jLabel7, javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(javax.swing.GroupLayout.Alignment.LEADING, layout.createSequentialGroup()
.addGap(8, 8, 8)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jLabel9)
.addComponent(jLabel8)
.addGroup(layout.createSequentialGroup()
.addGap(10, 10, 10)
.addComponent(jLabel6)))
.addGap(16, 16, 16)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jScrollPane5, javax.swing.GroupLayout.DEFAULT_SIZE, 200, Short.MAX_VALUE)
.addComponent(jScrollPane3, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, 200, Short.MAX_VALUE)
.addComponent(jScrollPane2, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, 200, Short.MAX_VALUE)
.addComponent(jScrollPane4, javax.swing.GroupLayout.DEFAULT_SIZE, 200, Short.MAX_VALUE))))
.addContainerGap())
);
layout.setVerticalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addContainerGap()
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jLabel4)
.addComponent(jTextField8, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGap(11, 11, 11)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jLabel1)
.addComponent(jTextField1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGap(22, 22, 22)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jTextField2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jLabel2))
.addGap(17, 17, 17)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jTextField3, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jLabel3))
.addGap(21, 21, 21)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jLabel5)
.addComponent(jTextField4, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGap(17, 17, 17)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jLabel10)
.addComponent(jTextField5, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGap(16, 16, 16)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jTextField6, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jLabel11))
.addGap(17, 17, 17)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jLabel12)
.addComponent(jTextField7, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGap(7, 7, 7)
.addComponent(jSeparator2, javax.swing.GroupLayout.PREFERRED_SIZE, 10, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGroup(layout.createSequentialGroup()
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jLabel6)
.addComponent(jScrollPane5, javax.swing.GroupLayout.PREFERRED_SIZE, 49, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGap(26, 26, 26)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jLabel7)
.addComponent(jScrollPane4, javax.swing.GroupLayout.PREFERRED_SIZE, 48, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGap(17, 17, 17)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jLabel8)
.addComponent(jScrollPane2, javax.swing.GroupLayout.PREFERRED_SIZE, 51, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGap(38, 38, 38)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jScrollPane3, javax.swing.GroupLayout.PREFERRED_SIZE, 61, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jLabel9)))
.addComponent(jSeparator1, javax.swing.GroupLayout.PREFERRED_SIZE, 282, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGap(37, 37, 37)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jButton1)
.addComponent(jButton2))
.addGap(43, 43, 43))
);
java.awt.Dimension screenSize = java.awt.Toolkit.getDefaultToolkit().getScreenSize();
setBounds((screenSize.width-521)/2, (screenSize.height-439)/2, 521, 439);
}// </editor-fold>
/**
* @param args the command line arguments
*/
public static void main(String args[]) {
java.awt.EventQueue.invokeLater(new Runnable() {
public void run() {
new NuevoRegistroClinico().setVisible(true);
}
});
}
// Variables declaration - do not modify
private javax.swing.JButton jButton1;
private javax.swing.JButton jButton2;
private javax.swing.JLabel jLabel1;
private javax.swing.JLabel jLabel10;
private javax.swing.JLabel jLabel11;
private javax.swing.JLabel jLabel12;
private javax.swing.JLabel jLabel2;
private javax.swing.JLabel jLabel3;
private javax.swing.JLabel jLabel4;
private javax.swing.JLabel jLabel5;
private javax.swing.JLabel jLabel6;
private javax.swing.JLabel jLabel7;
private javax.swing.JLabel jLabel8;
private javax.swing.JLabel jLabel9;
private javax.swing.JScrollPane jScrollPane2;
private javax.swing.JScrollPane jScrollPane3;
private javax.swing.JScrollPane jScrollPane4;
private javax.swing.JScrollPane jScrollPane5;
private javax.swing.JSeparator jSeparator1;
private javax.swing.JSeparator jSeparator2;
private javax.swing.JTextArea jTextArea1;
private javax.swing.JTextArea jTextArea2;
private javax.swing.JTextArea jTextArea3;
private javax.swing.JTextArea jTextArea4;
private javax.swing.JTextField jTextField1;
private javax.swing.JTextField jTextField2;
private javax.swing.JTextField jTextField3;
private javax.swing.JTextField jTextField4;
private javax.swing.JTextField jTextField5;
private javax.swing.JTextField jTextField6;
private javax.swing.JTextField jTextField7;
private javax.swing.JTextField jTextField8;
// End of variables declaration
}_________________________________________________________
Código del modulo ConsultaRegistroClinico
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
package hosipital;
import java.sql.SQLException;
import javax.swing.JOptionPane;
import javax.swing.table.DefaultTableModel;
public class ConsultaRegistroClinico extends javax.swing.JFrame
{
int navega = 0;
conexion con_people;
int inicia_combo = 0;
String ordenacao = "nombre";
public ConsultaRegistroClinico()
{
initComponents();
con_people = new conexion();
con_people.conecta();
con_people.executeSQL("select * from people order by "+ordenacao);
try
{
con_people.resultset.refreshRow();
mostrar_dados();
}
catch(SQLException erro)
{
System.out.println("Iniciando busqueda");
}
preencher_jtable();
}
// <editor-fold defaultstate="collapsed" desc=" Generated Code ">
private void initComponents() {
jPanel1 = new javax.swing.JPanel();
jTextField2 = new javax.swing.JTextField();
jLabel1 = new javax.swing.JLabel();
jTextField3 = new javax.swing.JTextField();
jLabel2 = new javax.swing.JLabel();
jButton1 = new javax.swing.JButton();
jPanel2 = new javax.swing.JPanel();
jLabel3 = new javax.swing.JLabel();
jLabel6 = new javax.swing.JLabel();
jLabel7 = new javax.swing.JLabel();
jLabel8 = new javax.swing.JLabel();
jPanel5 = new javax.swing.JPanel();
jScrollPane4 = new javax.swing.JScrollPane();
jTextArea3 = new javax.swing.JTextArea();
jLabel9 = new javax.swing.JLabel();
jLabel5 = new javax.swing.JLabel();
jScrollPane2 = new javax.swing.JScrollPane();
jTextArea1 = new javax.swing.JTextArea();
jScrollPane3 = new javax.swing.JScrollPane();
jTextArea2 = new javax.swing.JTextArea();
jScrollPane5 = new javax.swing.JScrollPane();
jTextArea4 = new javax.swing.JTextArea();
jScrollPane1 = new javax.swing.JScrollPane();
jTable1 = new javax.swing.JTable();
setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
setResizable(false);
jTextField2.setText(" ");
jLabel1.setText("Codigo:");
jTextField3.setText(" ");
jLabel2.setText("Nombre:");
jButton1.setText("Buscar");
javax.swing.GroupLayout jPanel2Layout = new javax.swing.GroupLayout(jPanel2);
jPanel2.setLayout(jPanel2Layout);
jPanel2Layout.setHorizontalGroup(
jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGap(0, 140, Short.MAX_VALUE)
);
jPanel2Layout.setVerticalGroup(
jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGap(0, 121, Short.MAX_VALUE)
);
javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1);
jPanel1.setLayout(jPanel1Layout);
jPanel1Layout.setHorizontalGroup(
jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel1Layout.createSequentialGroup()
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel1Layout.createSequentialGroup()
.addContainerGap()
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
.addComponent(jLabel2)
.addComponent(jLabel1))
.addGap(12, 12, 12)
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jTextField2, javax.swing.GroupLayout.PREFERRED_SIZE, 27, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGroup(jPanel1Layout.createSequentialGroup()
.addComponent(jTextField3, javax.swing.GroupLayout.PREFERRED_SIZE, 123, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(jButton1))))
.addComponent(jPanel2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addContainerGap(43, Short.MAX_VALUE))
);
jPanel1Layout.setVerticalGroup(
jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel1Layout.createSequentialGroup()
.addContainerGap()
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jLabel1)
.addComponent(jTextField2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGap(13, 13, 13)
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jLabel2)
.addComponent(jTextField3, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jButton1))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(jPanel2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(30, 30, 30))
);
jLabel3.setFont(new java.awt.Font("Tahoma", 1, 14));
jLabel3.setText("Datos del Registro Clinico");
jLabel6.setText("Sintomas:");
jLabel7.setText("Procedimiento:");
jLabel8.setText("Diagnostico:");
javax.swing.GroupLayout jPanel5Layout = new javax.swing.GroupLayout(jPanel5);
jPanel5.setLayout(jPanel5Layout);
jPanel5Layout.setHorizontalGroup(
jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGap(0, 497, Short.MAX_VALUE)
);
jPanel5Layout.setVerticalGroup(
jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGap(0, 0, Short.MAX_VALUE)
);
jTextArea3.setColumns(20);
jTextArea3.setRows(5);
jScrollPane4.setViewportView(jTextArea3);
jLabel9.setText("Indicaciones:");
jLabel5.setFont(new java.awt.Font("Tahoma", 1, 12));
jLabel5.setText("Registro Clinico del Paciente");
jTextArea1.setColumns(20);
jTextArea1.setRows(5);
jScrollPane2.setViewportView(jTextArea1);
jTextArea2.setColumns(20);
jTextArea2.setRows(5);
jScrollPane3.setViewportView(jTextArea2);
jTextArea4.setColumns(20);
jTextArea4.setRows(5);
jScrollPane5.setViewportView(jTextArea4);
jTable1.setModel(new javax.swing.table.DefaultTableModel(
new Object [][] {
{null, null, null, null, null, null, null, null},
{null, null, null, null, null, null, null, null},
{null, null, null, null, null, null, null, null},
{null, null, null, null, null, null, null, null}
},
new String [] {
"Fecha de consulta", "Nombre", "Apellido", "Edad", "Genero", "Estatura", "Peso", "Tipo Sanguineo"
}
));
jScrollPane1.setViewportView(jTable1);
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
getContentPane().setLayout(layout);
layout.setHorizontalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addGap(18, 18, 18)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jPanel1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jLabel5)
.addComponent(jLabel3)
.addGroup(layout.createSequentialGroup()
.addGap(10, 10, 10)
.addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 854, javax.swing.GroupLayout.PREFERRED_SIZE))))
.addGroup(layout.createSequentialGroup()
.addGap(608, 608, 608)
.addComponent(jPanel5, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGroup(layout.createSequentialGroup()
.addContainerGap()
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
.addComponent(jLabel8)
.addComponent(jLabel7)
.addComponent(jLabel9)
.addComponent(jLabel6))
.addGap(35, 35, 35)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false)
.addComponent(jScrollPane2, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jScrollPane3, javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jScrollPane4, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, 204, Short.MAX_VALUE)
.addComponent(jScrollPane5, javax.swing.GroupLayout.Alignment.LEADING))))
.addContainerGap())
);
layout.setVerticalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addContainerGap()
.addComponent(jLabel5)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(jPanel1, javax.swing.GroupLayout.PREFERRED_SIZE, 83, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(15, 15, 15)
.addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 99, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(46, 46, 46)
.addComponent(jLabel3)
.addGap(19, 19, 19)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jScrollPane2, javax.swing.GroupLayout.PREFERRED_SIZE, 45, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jLabel6))
.addGap(19, 19, 19)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jScrollPane4, javax.swing.GroupLayout.PREFERRED_SIZE, 33, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jLabel7))
.addGap(24, 24, 24)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jLabel8)
.addComponent(jScrollPane3, javax.swing.GroupLayout.PREFERRED_SIZE, 32, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGap(25, 25, 25)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addComponent(jLabel9)
.addGap(70, 70, 70)
.addComponent(jPanel5, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addComponent(jScrollPane5, javax.swing.GroupLayout.PREFERRED_SIZE, 46, javax.swing.GroupLayout.PREFERRED_SIZE)))
);
java.awt.Dimension screenSize = java.awt.Toolkit.getDefaultToolkit().getScreenSize();
setBounds((screenSize.width-926)/2, (screenSize.height-589)/2, 926, 589);
}// </editor-fold>
/**
* @param args the command line arguments
*/
public static void main(String args[]) {
java.awt.EventQueue.invokeLater(new Runnable() {
public void run() {
new ConsultaRegistroClinico().setVisible(true);
}
});
}
// Variables declaration - do not modify
private javax.swing.JButton jButton1;
private javax.swing.JLabel jLabel1;
private javax.swing.JLabel jLabel2;
private javax.swing.JLabel jLabel3;
private javax.swing.JLabel jLabel5;
private javax.swing.JLabel jLabel6;
private javax.swing.JLabel jLabel7;
private javax.swing.JLabel jLabel8;
private javax.swing.JLabel jLabel9;
private javax.swing.JPanel jPanel1;
private javax.swing.JPanel jPanel2;
private javax.swing.JPanel jPanel5;
private javax.swing.JScrollPane jScrollPane1;
private javax.swing.JScrollPane jScrollPane2;
private javax.swing.JScrollPane jScrollPane3;
private javax.swing.JScrollPane jScrollPane4;
private javax.swing.JScrollPane jScrollPane5;
private javax.swing.JTable jTable1;
private javax.swing.JTextArea jTextArea1;
private javax.swing.JTextArea jTextArea2;
private javax.swing.JTextArea jTextArea3;
private javax.swing.JTextArea jTextArea4;
private javax.swing.JTextField jTextField2;
private javax.swing.JTextField jTextField3;
// End of variables declaration
public void mostrar_dados()
{
try
{
con_people.resultset.getString("codigo");
con_people.resultset.getString("nombre");
con_people.resultset.getString("apellido");
con_people.resultset.getString("edad");
con_people.resultset.getString("genero");
con_people.resultset.getString("estatura");
con_people.resultset.getString("peso");
con_people.resultset.getString("tipo sanguineo");
}
catch(SQLException erro)
{
if (navega == 1)
JOptionPane.showMessageDialog(null,"Olha, você já está no primeiro registro");
else
if (navega == 2)
JOptionPane.showMessageDialog(null,"Olha, você já está no último registro");
else
JOptionPane.showMessageDialog(null,"Não localizou dados "+erro);
navega=0;
}
}
public void preencher_jtable()
{
jTable1.getColumnModel().getColumn(0).setPreferredWidth(20);
jTable1.getColumnModel().getColumn(1).setPreferredWidth(150);
jTable1.getColumnModel().getColumn(2).setPreferredWidth(20);
DefaultTableModel modelo = (DefaultTableModel)jTable1.getModel();
modelo.setNumRows(0);
try
{
while (con_people.resultset.next())
modelo.addRow(new Object []
{
con_people.resultset.getString("codigo"),
con_people.resultset.getString("nombre"),
con_people.resultset.getString("apellido"),
con_people.resultset.getString("edad"),
con_people.resultset.getString("genero"),
con_people.resultset.getString("estatura"),
con_people.resultset.getString("peso"),
con_people.resultset.getString("tipo sanguineo")
});
con_people.resultset.first();
}
catch (SQLException erro)
{
JOptionPane.showMessageDialog(null,"Erro ao listar no JTable "+erro);
}
}
public void ordem_visualizacao(String Ordem)
{
ordenacao = Ordem;
con_people.executeSQL("select * from people order by "+ordenacao);
preencher_jtable();
try
{
con_people.resultset.first();
}
catch (SQLException erro)
{
JOptionPane.showMessageDialog(null,"Erro na ordenação dos dados "+erro);
}
mostrar_dados();
}
}// FIN CLASE
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
para contactarme directamente aqui mi facebook --- https://www.facebook.com/chris.mcgraw.92
mi correo maxlorens8@gmail.com
Saludos y bendiciones amigo/@s!!