Bonsoir j'ai besoin d'aide si je sélectionne une ligne et clic sur le bouton supprimer ça ne marche pas voici mon programme :

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
43
44
45
46
47
48
49
50
51
52
53
 
import java.awt.BorderLayout;
import java.awt.Container;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
 
import javax.swing.table.DefaultTableModel;
import javax.swing.*;
 
@SuppressWarnings("serial")
public class Tables extends JFrame implements ActionListener{
	JScrollPane jsp;
	JTable tab;
	JButton bouton;
	Container c;
   private Object[][] cellules ={
      {"Mercure", "24400", "0", "false", "Color.yellow"},
      {"Vénus", "6052.0", "0", "false", "Color.yellow"},
      {"Terre", "6378.0", "1", "false", "Color.blue"},
      {"Mars", "3397.0", "2", "false", "Color.red"},
      {"Jupiter", "71492.0", "16", "true", "Color.orange"},
      {"Saturne", "60268.0", "18", "true", "Color.orange"},
      {"Uranus", "25559.0", "17", "true", "Color.blue"},
      {"Neptune", "24766.0", "8", "true", "Color.blue"},
      {"Pluton", "1137.0", "1", "false", "Color.black"}
   };
   public String[] nomColonnes = {"Planète", "Rayon", "Satellites", "Gazeuse", "Couleur"};
   int ligneSelectionne;
   public Tables() {
      super("Planètes");
      c=this.getContentPane();
      tab=new JTable(cellules, nomColonnes);
      jsp=new JScrollPane(tab);
      c.add(jsp);
      bouton.setText("Supprimer");
      bouton.addActionListener(this); 
      c.add(bouton,BorderLayout.SOUTH);
      pack();
      setDefaultCloseOperation(EXIT_ON_CLOSE);  
   }
 
   public void actionPerformed(ActionEvent e) {
		if (e.getSource() == bouton){
			DefaultTableModel model = (DefaultTableModel) tab.getModel();
	        model.removeRow(tab.getSelectedRow());
		}
	}
 
   public static void main(String[] args) {
	   Tables t=new Tables(); 
	   t.setVisible(true);
	   }
}
Merci d'avance pour votre aide.