Files
DEV/DEV.2.1/TP/TP8-Evenements/1.Fond/MainFond.java

87 lines
2.7 KiB
Java
Raw Normal View History

2025-03-05 12:29:30 +01:00
import javax.swing.*;
import java.awt.*;
public class MainFond {
public static void main(String[] args) {
JFrame frame = new JFrame("Fond");
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
2025-03-05 20:38:02 +01:00
Fond panel = new Fond();
2025-03-05 12:29:30 +01:00
frame.add(panel, BorderLayout.CENTER);
frame.setSize(500,500);
frame.setLocation(500,250);
frame.setVisible(true);
}
2025-03-05 20:38:02 +01:00
}
[srivasta@vm-srivasta 1.Fond]$ javac MainFond.java
./Fond.java:27: error: cannot find symbol
public void actionPerformed(ActionEvent evenement) {
^
symbol: class ActionEvent
location: class Fond
MainFond.java:12: error: no suitable method found for add(Fond,String)
frame.add(panel, BorderLayout.CENTER);
^
method Container.add(String,Component) is not applicable
(argument mismatch; Fond cannot be converted to String)
method Container.add(Component,int) is not applicable
(argument mismatch; Fond cannot be converted to Component)
method Container.add(Component,Object) is not applicable
(argument mismatch; Fond cannot be converted to Component)
./Fond.java:8: error: cannot find symbol
this.setLayout(null);
^
symbol: method setLayout(<null>)
./Fond.java:17: error: incompatible types: Fond cannot be converted to ActionListener
this.Cyan.addActionListener(this);
^
./Fond.java:18: error: incompatible types: Fond cannot be converted to ActionListener
this.Magenta.addActionListener(this);
^
./Fond.java:19: error: incompatible types: Fond cannot be converted to ActionListener
this.Jaune.addActionListener(this);
^
./Fond.java:21: error: cannot find symbol
frame.add(this.Cyan);
^
symbol: variable frame
location: class Fond
./Fond.java:22: error: cannot find symbol
frame.add(this.Magenta);
^
symbol: variable frame
location: class Fond
./Fond.java:23: error: cannot find symbol
frame.add(this.Jaune);
^
symbol: variable frame
location: class Fond
./Fond.java:26: error: method does not override or implement a method from a supertype
@Override
^
./Fond.java:29: error: cannot find symbol
frame.setBackground(Color.CYAN);
^
symbol: variable frame
location: class Fond
./Fond.java:31: error: cannot find symbol
frame.setBackground(Color.MAGENTA);
^
symbol: variable frame
location: class Fond
./Fond.java:33: error: cannot find symbol
frame.setBackground(Color.JAUNE);
^
symbol: variable JAUNE
location: class Color
./Fond.java:33: error: cannot find symbol
frame.setBackground(Color.JAUNE);
^
symbol: variable frame
location: class Fond
Note: Some messages have been simplified; recompile with -Xdiags:verbose to get full output
14 errors