update
This commit is contained in:
Binary file not shown.
Binary file not shown.
BIN
DEV.2.1/TP/TP6-Dessin/1.Formes/Formes.class
Normal file
BIN
DEV.2.1/TP/TP6-Dessin/1.Formes/Formes.class
Normal file
Binary file not shown.
@@ -13,20 +13,19 @@ public class Formes extends JComponent {
|
|||||||
protected void paintComponent(Graphics pinceau) {
|
protected void paintComponent(Graphics pinceau) {
|
||||||
|
|
||||||
Graphics secondPinceau = pinceau.create();
|
Graphics secondPinceau = pinceau.create();
|
||||||
|
|
||||||
secondPinceau.setColor(this.getForeground());
|
secondPinceau.setColor(this.getForeground());
|
||||||
secondPinceau.drawString("Bonjour !", 10, 20);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void main(String[] args) {
|
Font fonte = new Font("TimesRoman", Font.BOLD,24);
|
||||||
JFrame frame = new JFrame("Formes");
|
secondPinceau.setColor(new Color(128,0,128));
|
||||||
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
|
secondPinceau.setFont(fonte);
|
||||||
/*
|
secondPinceau.drawString(">o<", 10, 20);
|
||||||
Formes truc = new Formes();
|
|
||||||
frame.add(truc);
|
secondPinceau.setColor(Color.BLUE);
|
||||||
*/
|
secondPinceau.drawRect(70,10,50,50);
|
||||||
frame.setSize(500,500);
|
|
||||||
frame.setLocation(500,250);
|
secondPinceau.setColor(Color.GREEN);
|
||||||
frame.setVisible(true);
|
secondPinceau.drawOval(140,10,25,25);
|
||||||
}
|
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
BIN
DEV.2.1/TP/TP6-Dessin/1.Formes/MainFormes.class
Normal file
BIN
DEV.2.1/TP/TP6-Dessin/1.Formes/MainFormes.class
Normal file
Binary file not shown.
16
DEV.2.1/TP/TP6-Dessin/1.Formes/MainFormes.java
Normal file
16
DEV.2.1/TP/TP6-Dessin/1.Formes/MainFormes.java
Normal file
@@ -0,0 +1,16 @@
|
|||||||
|
import javax.swing.*;
|
||||||
|
import java.awt.*;
|
||||||
|
|
||||||
|
public class MainFormes{
|
||||||
|
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);
|
||||||
|
}
|
||||||
|
}
|
Before Width: | Height: | Size: 2.3 KiB After Width: | Height: | Size: 2.3 KiB |
Binary file not shown.
@@ -1,22 +0,0 @@
|
|||||||
|
|
||||||
|
|
||||||
import javax.swing.JComponent;
|
|
||||||
import java.awt.*;
|
|
||||||
|
|
||||||
public class Bonjour extends JComponent {
|
|
||||||
private Image pingouin;
|
|
||||||
public Bonjour() {
|
|
||||||
super();
|
|
||||||
this.pingouin = Toolkit.getDefaultToolkit().getImage("walk-0.png");
|
|
||||||
}
|
|
||||||
@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.drawImage(this.pingouin, 10, 20, this);
|
|
||||||
}
|
|
||||||
}
|
|
Reference in New Issue
Block a user