salut,
je veut que les colonnes de mon tableau soit non editable voila mon code :

Code : Sélectionner tout - Visualiser dans une fenêtre à part
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
 
public static void main(String[] args) {
    new MFrame();
}
 
 
private JTable table ;
private JButton button ;
private JButton button2 ;
private String col[] = new String[]{"Colonne 1","Colonne 2"};
private Object ob[][] = new Object[][]{{"1","2"},{"3","4"}};
 
public MFrame(){
    super("Programme test");
    configure();
    this.add(new JScrollPane(table), BorderLayout.CENTER);
    this.add(button, BorderLayout.SOUTH);
    this.add(button2, BorderLayout.NORTH);
    this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    this.pack();
    this.setVisible(true);
}
 
 
 
public void actionPerformed(ActionEvent e) {
 
    JButton source = (JButton)e.getSource();
    System.out.println("dsds");
    TableColumn column = table.getTableHeader().getColumnModel().getColumn(0);
    column.setHeaderValue(source.getText());
    table.getTableHeader().repaint();
}
 
 
 
private void configure()
 
{
 
table = new JTable(ob,col);
......