Ver Mensaje Individual
  #4 (permalink)  
Antiguo 24/04/2010, 10:18
Avatar de juamd
juamd
 
Fecha de Ingreso: marzo-2009
Ubicación: Bogotá
Mensajes: 285
Antigüedad: 15 años, 2 meses
Puntos: 8
Respuesta: Ayuda con jtable

Sigo con mi problema, esto es lo que tengo hasta el momento:

Código:
public class TablaLiberar extends JPanel {
     private double cedula;

public TablaLiberar(double cedula) {
        super(new GridLayout(1,0));
        this.cedula = cedula;

        JTable table = new JTable();

        DefaultTableModel modelo = (DefaultTableModel) table.getModel();
        modelo.setColumnCount(5);
        modelo.setRowCount(0);

        modelo.setColumnIdentifiers(new Object[]   
        {"nombre","apellido","deporte","edad","opcion"});

        Prestamo prestamo = new Prestamo();
        ArrayList<String> colPrestamos = new ArrayList<String>();
        ArrayList<String> temporal = new ArrayList<String>();
        colPrestamos = prestamo.getOperacionesEmpleado(this.cedula);
        int i;

        for(i=0;i<colPrestamos.size();i++){
             if(!colPrestamos.get(i).equals("-")){
                 temporal.add(colPrestamos.get(i));
             }else{
                 modelo.addRow(new Object[] {
                 temporal.get(0), temporal.get(1),  temporal.get(2), temporal.get(3), 
                 new Boolean(true)
                 });
                 temporal.clear();
             }
         }

        table.setPreferredScrollableViewportSize(new Dimension(500, 70));
        table.setFillsViewportHeight(true);

        //Create the scroll pane and add the table to it.
        JScrollPane scrollPane = new JScrollPane(table);

        //Add the scroll pane to this panel.
        add(scrollPane);

    }

}
Este metodo me permite llenar el jtable con los datos de una consulta, pero no me toma la última columna con un checkbox, además como puedo decirle que no permita editar las celdas ?

Saludos.