13 Mars
This commit is contained in:
24
DEV2.1/TP4:Heritage/Grisaille.java
Normal file
24
DEV2.1/TP4:Heritage/Grisaille.java
Normal file
@@ -0,0 +1,24 @@
|
||||
import javax.swing.*;
|
||||
import java.awt.*;
|
||||
|
||||
public class Grisaille extends Color{
|
||||
|
||||
public Grisaille(int val){
|
||||
super(val, val, val);
|
||||
}
|
||||
|
||||
public static void main(String[] args) {
|
||||
if (args.length <= 0){
|
||||
System.err.println("args missing");
|
||||
System.exit(1);
|
||||
} Integer arg = Integer.parseInt(args[0], 10);
|
||||
JFrame fenetre = new JFrame();
|
||||
fenetre.setSize(400, 200);
|
||||
fenetre.setLocation(0, 0);
|
||||
fenetre.setVisible(true);
|
||||
JPanel panel = new JPanel();
|
||||
panel.setBackground(new Grisaille(arg));
|
||||
fenetre.add(panel);
|
||||
fenetre.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user