update
This commit is contained in:
@@ -29,6 +29,11 @@ public class Formes extends JComponent {
|
||||
|
||||
secondPinceau.drawImage(this.img, 180,10, this);
|
||||
|
||||
secondPinceau.drawLine(0,0,90,100);
|
||||
secondPinceau.drawLine(100,0,90,100);
|
||||
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -1,16 +1,17 @@
|
||||
|
||||
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);
|
||||
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
|
||||
|
||||
Formes truc = new Formes();
|
||||
frame.add(truc);
|
||||
|
||||
frame.setSize(500,500);
|
||||
frame.setLocation(500,250);
|
||||
frame.setVisible(true);
|
||||
}
|
||||
}
|
@@ -5,8 +5,15 @@ public class MainSautoir {
|
||||
public static void main(String[] args){
|
||||
JFrame frame = new JFrame("Sautoir");
|
||||
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
|
||||
|
||||
|
||||
GridLayout gestionnaire = new GridLayout(2, 5);
|
||||
frame.setLayout(gestionnaire);
|
||||
|
||||
|
||||
Sautoir instance = new Sautoir();
|
||||
|
||||
frame.add(instance);
|
||||
frame.setSize(500,500);
|
||||
frame.setLocation(500,250);
|
||||
frame.setVisible(true);
|
||||
|
@@ -2,17 +2,23 @@ import javax.swing.*;
|
||||
import java.awt.*;
|
||||
|
||||
public class Sautoir extends JComponent {
|
||||
private Image img;
|
||||
|
||||
public Sautoir() {
|
||||
super();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void paintComponent(Graphics pinceau) {
|
||||
|
||||
Graphics secondPinceau = pinceau.create();
|
||||
secondPinceau.setColor(this.getForeground());
|
||||
|
||||
}
|
||||
int col = 5;
|
||||
int ligne = 5;
|
||||
int caseWidth = getWidth() / col;
|
||||
int caseHeight = getHeight() / ligne;
|
||||
secondPinceau.setColor(Color.CYAN);
|
||||
int[] xPoints = {0,caseWidth * col, 0, caseWidth * col};
|
||||
int[] yPoints = {0,0,caseHeight * ligne, caseHeight * ligne};
|
||||
secondPinceau.fillPolygon(xPoints, yPoints, 4);
|
||||
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user