Foros del Web » Programación para mayores de 30 ;) » Java »

ayuda no me agrega en el jtable??

Estas en el tema de ayuda no me agrega en el jtable?? en el foro de Java en Foros del Web. Código HTML: public void reporte_Cita(){ try { Citas c =new Citas(); Paciente p=new Paciente(); GregorianCalendar g=new GregorianCalendar(); String dia =Integer.toString(jCalendar3.getCalendar().get(g.DAY_OF_MONTH)); if(Integer.parseInt(dia)<10)dia="0"+dia; String mes =Integer.toString(1+jCalendar3.getCalendar().get(g.MONTH)); if(Integer.parseInt(mes)<10)mes="0"+mes; ...
  #1 (permalink)  
Antiguo 01/06/2010, 10:28
 
Fecha de Ingreso: mayo-2006
Mensajes: 101
Antigüedad: 17 años, 11 meses
Puntos: 2
ayuda no me agrega en el jtable??

Código HTML:
public void reporte_Cita(){
    try {  
         Citas c =new Citas();
         Paciente p=new Paciente();
         GregorianCalendar g=new GregorianCalendar();                
             String dia =Integer.toString(jCalendar3.getCalendar().get(g.DAY_OF_MONTH));
             if(Integer.parseInt(dia)<10)dia="0"+dia;   
             String mes =Integer.toString(1+jCalendar3.getCalendar().get(g.MONTH));
             if(Integer.parseInt(mes)<10)mes="0"+mes;
             String anio=Integer.toString(jCalendar3.getCalendar().get(g.YEAR));
         c.fecha= dia+"/"+mes+"/"+anio;
         String aux=jComboBox5.getSelectedItem().toString();
         c.idMedico=aux.substring(0,13);
           Controlador_Paciente pac =new Controlador_Paciente(p,'s');
           Controlador_Citas cit =new Controlador_Citas(c,'m'); 
              for(int i=0;i<cit.lista.size();i++){
                  c=(Citas)cit.lista.get(i);
                  System.out.println(p.nombre+p.a_Paterno);
                     for(int j=0;j<pac.lista.size();j++){
                         p=(Paciente)pac.lista.get(j);
                            if(p.idPaciente.equals(c.idPaciente)){
                               String titulos[]={"Paciente","Hora","Fecha","No de Expediente"};                               
                               Object obj[][]=new Object[cit.lista.size()][999];
                               obj[i][0]="   "+p.nombre+"  "+p.a_Paterno+"  "+p.a_Materno;
                               obj[i][1]="   "+c.hora.toString();
                               obj[i][2]="   "+c.fecha.toString();
                               obj[i][3]="   "+p.noExp.toString();
                               jTable1.setModel(new javax.swing.table.DefaultTableModel(obj,titulos));
                            }
                    }
             }
          }catch (Exception e) { System.out.println("Error jList"); }
        }
  #2 (permalink)  
Antiguo 02/06/2010, 12:59
 
Fecha de Ingreso: mayo-2010
Ubicación: Chilpancingo, Gro
Mensajes: 25
Antigüedad: 13 años, 11 meses
Puntos: 0
Respuesta: ayuda no me agrega en el jtable??

y donde creas tu JTable??, crea tu JT en donde le pones el modelo y listo!.
JTable jTable1= new JTable(obj,titulos);

me parece que asi debe funcionar.

Etiquetas: jtable
Atención: Estás leyendo un tema que no tiene actividad desde hace más de 6 MESES, te recomendamos abrir un Nuevo tema en lugar de responder al actual.
Respuesta




La zona horaria es GMT -6. Ahora son las 09:11.