bonjour,
je voudrais savoir comment pour faire quitter ma fenetre avec un bonton qui se trouve
sur ma fenetre . existe t'il une methode .
ma fenetre :il me fautrait une methode pour que je puisse fermer la fenetre par son propre bonton , ça je ne sais pas faire
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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87 public void ihmprincipale() { Container contenu = this.getContentPane(); setSize(400,240); contenu.setLayout(new BorderLayout()); // JPanel panelprincipale =new JPanel(); panelprincipale.setLayout(new BorderLayout()); // JPanel panelnordtext =new JPanel(); JLabel Labelprincipale=new JLabel("Creation Article v1.0"); panelnordtext.add(Labelprincipale); panelprincipale.add(BorderLayout.NORTH,panelnordtext); // JPanel panelcentre =new JPanel(); panelcentre.setLayout(new GridLayout(4,1)); // JPanel panelcentregrid =new JPanel(); JLabel Labentreprise =new JLabel("Creation Nouveau Client "); panelcentregrid.add(Labentreprise); entreprisecreer =new JButton("Creer"); entreprisecreer.addActionListener(this); panelcentregrid.add(entreprisecreer); JButton entreprisemodifier =new JButton("Modifier"); panelcentregrid.add(entreprisemodifier); panelcentre.add(panelcentregrid); JPanel panelcentregrid1 =new JPanel(); JLabel Labcategorie =new JLabel("Creation Seulement Categorie "); panelcentregrid1.add(Labcategorie); JButton Categoriecreer =new JButton("Creer"); panelcentregrid1.add(Categoriecreer); JButton Categoriemodifier =new JButton("Modifier"); panelcentregrid1.add(Categoriemodifier); // panelcentre.add(panelcentregrid1); // JPanel panelcentregrid2 =new JPanel(); JLabel Labsouscategorie =new JLabel("Creation Seulement Sous Categorie"); panelcentregrid2.add(Labsouscategorie); JButton sousCategoriecreer =new JButton("Creer"); panelcentregrid2.add(sousCategoriecreer); JButton sousCategoriemodifier =new JButton("Modifier"); panelcentregrid2.add(sousCategoriemodifier); // panelcentre.add(panelcentregrid2); // JPanel panelcentregrid3 =new JPanel(); JLabel Labarticle =new JLabel("Creation Article "); panelcentregrid3.add(Labarticle); JButton articlecreer =new JButton("Creer"); panelcentregrid3.add(articlecreer); JButton articlemodifier =new JButton("Modifier"); panelcentregrid3.add(articlemodifier); // panelcentre.add(panelcentregrid3); panelprincipale.add(BorderLayout.CENTER,panelcentre); // JPanel panelsud=new JPanel(); JButton Butsudquitter =new JButton("Quitter"); panelsud.add(Butsudquitter); // panelprincipale.add(BorderLayout.SOUTH,panelsud); contenu.add(BorderLayout.SOUTH,panelprincipale); }
l'implementaion se fera :merci !
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7 public void actionPerformed(ActionEvent e) { if(e.getSource().equals(entreprisecreer)) { }}
Partager