ActionEvent non reconnue sous Eclipse
Bonjour,
Je reviens vers vous pour un message d'erreur du type
Code:
ActionEvent cannot be resolved to a type
alors que mon code semble être correcte
Code:
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
|
package pobjet;
import javax.swing.JFrame;
import javax.swing.JPanel;
import javax.swing.JLabel;
import javax.swing.JButton;
import java.awt.event.ActionListener;
import java.awt.*;
import java.io.*;
public class Form1 extends JFrame implements ActionListener {
public Form1()
{
this.setTitle("Mon premier formulaire");
this.setSize(new Dimension(320,240));
this.setLocationRelativeTo(null);
this.setResizable(true);
this.setContentPane(buildContentpane());
}
private JPanel buildContentpane() {
JPanel panel = new JPanel();
panel.setLayout(new FlowLayout());
panel.setBackground(Color.white);
//JLabel labe1= new JLabel("Résultat : Pas encore calculé");
//panel.add(labe1);
JButton bouton=new JButton("Cliquez ici !");
bouton.addActionListener(this);
panel.add(bouton);
JButton bouton2 = new JButton("Ou là !");
bouton2.addActionListener(this);
panel.add(bouton2);
return panel;
}
public void actionPerformed(ActionEvent e)
{
System.out.println("Clic");
}
/**
* @param args
*/
public static void main(String[] args) {
// TODO Auto-generated method stub
new Form1().setVisible(true);
}
} |
quel est le problème ?
Merci pour une solution
Cordialement