Problema al cargar un " Jlist "
Publicado por jkroZ! (1 intervención) el 02/05/2006 07:31:11
Este es la funcion,,, el problema es k no carga..
Trabajo en netbeans ide 5.0
el objeto es jlist1
public void Mostrar_Emp(){
try{
Vector contenido = new Vector();
stmt1=conexion.createStatement();
cur_res1=stmt1.executeQuery("SELECT * FROM empleado");
// Almacena en el vector el rut y apallido sin problemas
while (cur_res1.next()){
String apell = cur_res1.getString("paterno_empleado");
String rut = cur_res1.getString("rut_empleado");
contenido.add(rut + " " + apell);
}
System.out.println("----> "+contenido);
// aquí muestro los datos del vector y ningún problema
jList1 = new JList(contenido);
jList1.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
jList1.setSelectedIndex(0);
JScrollPane listScrollPane = new JScrollPane(jList1);
getContentPane().add(listScrollPane , BorderLayout.CENTER);
}catch (SQLException sqle) {
System.out.println("Error en la ejecución:"
+ sqle.getErrorCode() + " " + sqle.getMessage()); }
}
Podrían darme una mano con esto..!
Trabajo en netbeans ide 5.0
el objeto es jlist1
public void Mostrar_Emp(){
try{
Vector contenido = new Vector();
stmt1=conexion.createStatement();
cur_res1=stmt1.executeQuery("SELECT * FROM empleado");
// Almacena en el vector el rut y apallido sin problemas
while (cur_res1.next()){
String apell = cur_res1.getString("paterno_empleado");
String rut = cur_res1.getString("rut_empleado");
contenido.add(rut + " " + apell);
}
System.out.println("----> "+contenido);
// aquí muestro los datos del vector y ningún problema
jList1 = new JList(contenido);
jList1.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
jList1.setSelectedIndex(0);
JScrollPane listScrollPane = new JScrollPane(jList1);
getContentPane().add(listScrollPane , BorderLayout.CENTER);
}catch (SQLException sqle) {
System.out.println("Error en la ejecución:"
+ sqle.getErrorCode() + " " + sqle.getMessage()); }
}
Podrían darme una mano con esto..!
Valora esta pregunta


0