ragazzi aiutatemi
se devo visualizzare due tabelle chiamando il metodo web() che a sua volta chiama scheda() lo fa: mettendo su uno stesso JPanel due tabelle
codice:
public void web()
{ GridBagConstraints c = new GridBagConstraints();
if (ris==0){
c.gridx=0;
c.gridy=1;}
else {c.gridx=1;
c.gridy=2;}
c.weightx = 0.2;
c.weighty = 0.2;
c.fill = GridBagConstraints.BOTH;
//Hashtable tabella = new Hashtable();
Object [][] tabella = new Object[5][9];
// HashMap tabella = new HashMap();
String[] nome ={"nome", "indirizzo", "path", "dimensione","directory", "contenuto"};
JTable tab = new JTable (tabella, nome);
//tab.setPreferredSize(new Dimension(10,100));
tabella[1][2]= "5";
//tab.setBounds(10,10, 10,10 );
p_job.add(tab,c);
// tab.setRowSelectionInterval(10,10);
JScrollPane scroll = new JScrollPane(tab);
//scroll.setPreferredSize(new Dimension(1000,1000));
p_job.add(scroll,c);
scheda();
}
public void scheda()
{ GridBagConstraints c = new GridBagConstraints();
if (ris==0){
c.gridx=0;
c.gridy=2; }
else {c.gridx=1;
c.gridy=3; }
c.weightx = 1.0;
c.weighty = 1.0;
c.fill = GridBagConstraints.BOTH;
//Hashtable tabella = new Hashtable();
Object [][] tabella = new Object[150][8];
// HashMap tabella = new HashMap();
String[] nome ={"nome", "tipo", "scopo", "data estrazione","provenienza", "client/server", "frequenza utilizzo", "codice"};
JTable tabb = new JTable (tabella, nome);
//tabb.setPreferredSize(new Dimension(10,500));
tabella[1][2]= "5";
p_job.add(tabb,c);
// tab.setRowSelcectionInterval(10,10);
JScrollPane scroll = new JScrollPane(tabb);
p_job.add(scroll,c);
this.validate();
}
però se chiamo il metodo dirr() che mi rappresenta una terza tabella da mettere sullo stesso JPanel p_job nn mi visualizza nulla
codice:
public void dirr()
{
try {GridBagConstraints cc = new GridBagConstraints();
cc.gridx=0;
cc.gridy=0;
cc.weightx = 1.0;
cc.weighty = 1.0;
// c.fill = GridBagConstraints.VERTICAL;
//c.fill = GridBagConstraints.FIRST_LINE_END;
//Hashtable tabella = new Hashtable();
Object [][] tabella = new Object[0][4];
// HashMap tabella = new HashMap();
String[] nome ={"nome", "path", "dimensione","data creazione"};
JTable tabb0 = new JTable(tabella, nome);
//tab.setPreferredSize(new Dimension(10,100));
tabella[0][2]= "5";
p_job.add(tabb0,c);
// this.validate();
//tab.setBounds(10,10, 10,10 );
// tab.setRowSelectionInterval(10,10);
JScrollPane scroll = new JScrollPane(tabb0);
p_job.add(scroll,c);
web();
}
catch (Exception e){}
}
perchè non mi visualizza nulla?
:master: :master: