Bonjour,

Je débute la programmation JAVA évènementielle avec Eclipse.

Je m'entraîne à programmer le comportement d'un bouton avec ActionListener. Il y a des problèmes de compilation, mais je ne crois pas avoir écrit quelque chose de différent que dans les tutoriels que j'ai pu lire.

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
 
import java.awt.Color;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
 
import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JPanel;
 
 
public class window extends JFrame implements ActionListener {
 
	public window() {
		JFrame F = new JFrame();
		F.setBounds(10, 10, 300, 300);
		F.setVisible(true);
		F.setResizable(false);
		F.setLayout(null);
 
		JPanel P = new JPanel();
		P.setBackground(Color.blue);
		F.setContentPane(P);
 
		JButton B = new JButton("test me");
		B.setBounds(125, 10, 100, 100);
		P.add(B);
		B.addActionListener(this); 
	}
 
	public void ActionPerformed (ActionEvent e){
 
	}
Eclipse me signale les erreurs suivantes à la ligne "public class window extends JFrame implements ActionListener {" :
=> 1 method to implement:
- java.awt.event.ActionListener.actionPerformed()

=> Multiple markers at this line
- The type window must implement the inherited abstract method
ActionListener.actionPerformed(ActionEvent)
- Breakpoint:window
- The serializable class window does not declare a static final serialVersionUID field of type long

Merci d'avance !