23 lines
648 B
Java
23 lines
648 B
Java
|
import javax.swing.JComponent;
|
||
|
import java.awt.Graphics;
|
||
|
|
||
|
public class Bonjour extends JComponent {
|
||
|
@Override
|
||
|
protected void paintComponent(Graphics pinceau) {
|
||
|
Graphics secondPinceau = pinceau.create();
|
||
|
if (this.isOpaque()) {
|
||
|
secondPinceau.setColor(this.getBackground());
|
||
|
secondPinceau.fillRect(0, 0, this.getWidth(), this.getHeight());
|
||
|
}
|
||
|
|
||
|
secondPinceau.setColor(new Color.BLUE);
|
||
|
secondPinceau.drawRect(20,20, 50, 50);
|
||
|
|
||
|
secondPinceau.setColor(new Color.GREEN);
|
||
|
secondPinceau.fillOval(80, 20, 50, 50);
|
||
|
|
||
|
secondPinceau.setColor(new Color.BLACK);
|
||
|
secondPinceau.drawString(140, 20, 50, 50)
|
||
|
}
|
||
|
}
|