APL/APL2.1/TP07/Formes/Formes.java

32 lines
745 B
Java
Raw Normal View History

2022-03-07 17:26:31 +01:00
import javax.swing.*;
import java.awt.*;
class NewJFrame extends JComponent {
public NewJFrame() {
super();
}
@Override
protected void paintComponent(Graphics brush) {
Graphics newBrush = brush.create();
if (this.isOpaque()) {
newBrush.setColor(this.getBackground());
newBrush.fillRect(0, 0, this.getWidth(), this.getHeight());
}
newBrush.setColor(this.getForeground());
}
}
public class Formes {
public static void main(String[] args) {
JFrame f = new JFrame("Formes");
f.setSize(500, 500);
f.setLocation(100, 100);
f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
f.setVisible(true);
}
}