update
This commit is contained in:
@@ -29,6 +29,11 @@ public class Formes extends JComponent {
|
|||||||
|
|
||||||
secondPinceau.drawImage(this.img, 180,10, this);
|
secondPinceau.drawImage(this.img, 180,10, this);
|
||||||
|
|
||||||
|
secondPinceau.drawLine(0,0,90,100);
|
||||||
|
secondPinceau.drawLine(100,0,90,100);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -1,3 +1,4 @@
|
|||||||
|
|
||||||
import javax.swing.*;
|
import javax.swing.*;
|
||||||
import java.awt.*;
|
import java.awt.*;
|
||||||
|
|
||||||
|
@@ -7,6 +7,13 @@ public class MainSautoir {
|
|||||||
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
|
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.setSize(500,500);
|
||||||
frame.setLocation(500,250);
|
frame.setLocation(500,250);
|
||||||
frame.setVisible(true);
|
frame.setVisible(true);
|
||||||
|
@@ -2,17 +2,23 @@ import javax.swing.*;
|
|||||||
import java.awt.*;
|
import java.awt.*;
|
||||||
|
|
||||||
public class Sautoir extends JComponent {
|
public class Sautoir extends JComponent {
|
||||||
private Image img;
|
|
||||||
|
|
||||||
public Sautoir() {
|
public Sautoir() {
|
||||||
super();
|
super();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
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());
|
||||||
|
|
||||||
}
|
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