Bonjour tout le monde

Je travaille sur un petit exercice pour creer une interface graphique avec SWING seulement je ne parviens pas a trouver des tutos pour m'aider dans la selection de la gestion d'evenements.

comme vous le verrez dans mon code il ya 4 bouttons. Bon pour le listener de la fermeture c facile mais en ce qui concerne les events pour supprimer le text ecrit dans les zones de text ainsi que la sauvgarde des donnees dans un fichier Access.

donc boutton 1 <NEW> une nouvelle entree
Boutton 2 <SAVE> sauvegarde sur ACESS
bouton 3<CLEAR> effacer les champs texts

MERCI BEAUCOUP

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
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
 
 
import javax.swing.*;
import java.awt.*;
import javax.swing.border.*;
import java.awt.event.*;
 
 
public class RegClass extends ExitableJFrame {
 
 
//	Setting up the Listener Platform
	static class MyActionListener implements ActionListener {
		public void actionPerformed(ActionEvent event){
		System.exit(0);
		}
 
 
	}
 
	static class MyActionListener1 implements ActionListener {
	public void actionPerformed(ActionEvent event){
		System.getProperty("");
	}
	}
 
 
 
 
 
 
 
 
 
 
 
 
 
	public static void main(String[] args) {
 
		ExitableJFrame MainFrame= new ExitableJFrame("Registration Form");
 
		// create the Upper Interface Panel 
 
		JPanel pane1=new JPanel();
		Border bored=BorderFactory.createTitledBorder("Infos");
		pane1.setBorder(bored);
		JLabel label1= new JLabel("ID");
		JLabel label2=new JLabel("NAME");
		JLabel label3=new JLabel("MAJOR");
		JTextField text1= new JTextField();
		ActionListener action1= new MyActionListener();
		text1.addActionListener(action1);
		JTextField text2=new JTextField();
 
		// Setting up the ComboBox Sub Options
 
		String major[]={"ICS","ITC","MIS"};
		JComboBox stream= new JComboBox(major);
 
		// Set Components Position with GridLayout Property
		pane1.setLayout(new GridLayout(3,2));
		pane1.add(label1);
		pane1.add(text1);
		pane1.add(label2);
		pane1.add(text2);
		pane1.add(label3);
		pane1.add(stream);
		// Set Components Position with BorderLayout Property
		MainFrame.getContentPane().add(pane1, BorderLayout.NORTH);
 
 
		// create the Intermediate Interface Panel
 
		JPanel interpane= new JPanel();
		JLabel label4= new JLabel(new ImageIcon("myicon.gif"));
		interpane.setLayout(new BorderLayout());
		interpane.add(label4, BorderLayout.CENTER);
		MainFrame.getContentPane().add(interpane, BorderLayout.CENTER);
 
 
 
 
		// create the  Buttom Interface Panel
 
		JPanel pane2=new JPanel();
		Border bored1=BorderFactory.createTitledBorder("Buttons");
		pane2.setBorder(bored1);
		JButton button1= new JButton("NEW");
		JButton button2= new JButton("SAVE");
		JButton button3= new JButton("CLEAR");
 
 
 
		JButton button4= new JButton("CLOSE");
		ActionListener action4= new MyActionListener();
		button4.addActionListener(action4);
 
		// Set Components Position with FlowLayout Property
		pane2.setLayout(new FlowLayout());
		pane2.add(button1);
		pane2.add(button2);
		pane2.add(button3);
		pane2.add(button4);
		MainFrame.getContentPane().add(pane2, BorderLayout.SOUTH);
 
 
 
 
 
 
 
 
 
 
 
		MainFrame.setSize(400,340);
		MainFrame.show();
 
 
 
	}
 
}