push
This commit is contained in:
BIN
DEV2.1/TP06/Exo1/Carre.class
Normal file
BIN
DEV2.1/TP06/Exo1/Carre.class
Normal file
Binary file not shown.
27
DEV2.1/TP06/Exo1/Carre.java
Normal file
27
DEV2.1/TP06/Exo1/Carre.java
Normal file
@@ -0,0 +1,27 @@
|
||||
import javax.swing.*;
|
||||
import java.awt.*;
|
||||
|
||||
public class Carre extends JComponent{
|
||||
|
||||
private Image pingouin;
|
||||
|
||||
public Carre(){
|
||||
super();
|
||||
this.pingouin = Toolkit.getDefaultToolkit().getImage("cercles.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.setColor(Color.BLUE);
|
||||
secondPinceau.drawRect(150,200,50,50);
|
||||
secondPinceau.setColor(Color.GREEN);
|
||||
secondPinceau.drawOval(100,100,25,25);
|
||||
secondPinceau.drawImage(this.pingouin, 150, 125, this);
|
||||
secondPinceau.drawString("Bonjour !", 300, 180);
|
||||
}
|
||||
}
|
||||
BIN
DEV2.1/TP06/Exo1/Formes.class
Normal file
BIN
DEV2.1/TP06/Exo1/Formes.class
Normal file
Binary file not shown.
21
DEV2.1/TP06/Exo1/Formes.java
Normal file
21
DEV2.1/TP06/Exo1/Formes.java
Normal file
@@ -0,0 +1,21 @@
|
||||
import javax.swing.*;
|
||||
import java.awt.*;
|
||||
|
||||
|
||||
public class Formes{
|
||||
public static void main(String[] args) {
|
||||
JFrame fenetre = new JFrame();
|
||||
fenetre.setSize(1920, 1080);
|
||||
fenetre.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
|
||||
|
||||
GridLayout orga = new GridLayout(2,2);
|
||||
fenetre.setLayout(orga);
|
||||
Carre lesformes = new Carre();
|
||||
fenetre.add(lesformes, BorderLayout.CENTER);
|
||||
fenetre.setVisible(true);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
BIN
DEV2.1/TP06/Exo1/cercles.png
Normal file
BIN
DEV2.1/TP06/Exo1/cercles.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 1.9 KiB |
Reference in New Issue
Block a user