Ajout des travaux effectuer
This commit is contained in:
31
23DEV1.1/TPS2/TP01/Dessin/Formes/Formes.java
Normal file
31
23DEV1.1/TPS2/TP01/Dessin/Formes/Formes.java
Normal file
@@ -0,0 +1,31 @@
|
||||
import javax.swing.JComponent;
|
||||
import java.awt.*;
|
||||
|
||||
public class Formes
|
||||
{
|
||||
private Image trucChelou;
|
||||
public void paintComponent(Graphics g)
|
||||
{
|
||||
Graphics secondPinceau = g.create();
|
||||
if(isOpaque())
|
||||
{
|
||||
secondPinceau.setColor(getBackground());
|
||||
secondPinceau.drawRect(0, 0, getWidth(), getHeight());
|
||||
}
|
||||
secondPinceau.setColor(color.BLUE);
|
||||
fillRect(10, 10, 50, 50);
|
||||
secondPinceau.setColor(color.GREEN);
|
||||
drawOval(30,30, 25, 25);
|
||||
secondPinceau.setColor(color.MAGENTA);
|
||||
secondPinceau.drawString(">o<",getWidth()/2 - 30, getHeight()/2);
|
||||
secondPinceau.("cercles.png", );
|
||||
}
|
||||
public static void main(String[] args)
|
||||
{
|
||||
JFrame frame = new JFrame("Frame");
|
||||
frame.setSize(400, 400);
|
||||
frame.setLocationRelativeTo(null);
|
||||
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
|
||||
frame.setVisible(true);
|
||||
}
|
||||
}
|
||||
BIN
23DEV1.1/TPS2/TP01/Dessin/Formes/cercles.png
Normal file
BIN
23DEV1.1/TPS2/TP01/Dessin/Formes/cercles.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 1.9 KiB |
22
23DEV1.1/TPS2/TP01/Dessin/sautoir.java
Normal file
22
23DEV1.1/TPS2/TP01/Dessin/sautoir.java
Normal file
@@ -0,0 +1,22 @@
|
||||
import javax.swing.*;
|
||||
import java.awt.*;
|
||||
|
||||
public class sautoir
|
||||
{
|
||||
@Override
|
||||
protected void paintComponent(Graphics g)
|
||||
{
|
||||
Graphics pinceau = g.create();
|
||||
if(isOpaque())
|
||||
{
|
||||
pinceau.setColor(getBackground());
|
||||
pinceau.fillRect(0, 0, getWidth(), getHeight());
|
||||
}
|
||||
pinceau.setColor(Color.CYAN);
|
||||
int[] triangleXPoints = {0, getWidth()/2, getWidth()};
|
||||
int[] topTriangleXPoints = {0, getHeight()/2, 0};
|
||||
pinceau.fillPolygon(triangleXPoints, topTriangleXPoints, 3);
|
||||
int[] bottomTriangleXPoints = {getHeight(), getHeight()/2, getHeight()};
|
||||
pinceau.fillPolygon(triangleXPoints, bottomTriangleXPoints, 3);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user