update
This commit is contained in:
@@ -0,0 +1,32 @@
|
||||
import javax.swing.*;
|
||||
import java.awt.*;
|
||||
|
||||
public class Formes extends JComponent {
|
||||
private Image img;
|
||||
|
||||
public Formes() {
|
||||
super();
|
||||
this.img = Toolkit.getDefaultToolkit().getImage("img.png");
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void paintComponent(Graphics pinceau) {
|
||||
|
||||
Graphics secondPinceau = pinceau.create();
|
||||
|
||||
secondPinceau.setColor(this.getForeground());
|
||||
secondPinceau.drawString("Bonjour !", 10, 20);
|
||||
}
|
||||
|
||||
public static void main(String[] args) {
|
||||
JFrame frame = new JFrame("Formes");
|
||||
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
|
||||
/*
|
||||
Formes truc = new Formes();
|
||||
frame.add(truc);
|
||||
*/
|
||||
frame.setSize(500,500);
|
||||
frame.setLocation(500,250);
|
||||
frame.setVisible(true);
|
||||
}
|
||||
}
|
BIN
DEV.2.1/TP/TP6-Dessin/img.png
Normal file
BIN
DEV.2.1/TP/TP6-Dessin/img.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 2.3 KiB |
Reference in New Issue
Block a user