quand on crée une table avec Modele comment on peut rendre invisible la table sachant qu'on on fait
la tablesera invisible mais la premiere ligne restera visibleCode:matable.setVisible(false)
merci
Version imprimable
quand on crée une table avec Modele comment on peut rendre invisible la table sachant qu'on on fait
la tablesera invisible mais la premiere ligne restera visibleCode:matable.setVisible(false)
merci
Salut,
C'est le header qui reste visible, pas la première ligne. Ta JTable, elle, est bien invisible.
Code:matable.getTableHeader().setVisible(false);
ça ne marche pas avec
car j'ai créé une table avec les Modele?Code:matable.getTableHeader().setVisible(false);
Post ton code, parce que là...
voici la classe qui me crée la tableModele
et dans ma classe pricipale je crée la table:Code:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67 import java.awt.Color; import javax.swing.table.AbstractTableModel; class MyTableModel extends AbstractTableModel { private String[] colonne ; private String Ad[][]; MyTableModel(int som,String [][]adjascence) { colonne=new String[som+1]; colonne[0]="Sommet"; Ad=new String[som][som+1]; Ad=adjascence; for(int i=1;i<=som;i++) { colonne[i]="S"+(i-1); } } public int getColumnCount() { return colonne.length; } public String [] getNonC(int a) { if(a!=0)return this.colonne; else return null; } public int getRowCount() { return Ad.length; } public String getColumnName(int col) { return colonne[col]; } public Object getValueAt(int row, int col) { return Ad[row][col]; } public Class getColumnClass(int c) { return getValueAt(0, c).getClass(); } public boolean isCellEditable(int row, int col) { if (col < 1) { return false; } else { return true; } } public String[] getCol(int som) { String[] as=new String[som]; return as; } }
maisquand je faisCode:
1
2
3
4
5
6 // tel que som et ad je l'ai initialise int som; String[] ad; TT=new MyTableModel(som,ad); table=new JTable(TT);
le Header reste afficherCode:
1
2
3 table.getTableHeader().setVisible(false) table.setVisible(false);
Peut-tu poster le code qui créé la JFrame et la JTable ?