26 lines
647 B
Java
26 lines
647 B
Java
import javax.swing.JComponent;
|
|
import java.awt.Graphics;
|
|
import java.awt.Color;
|
|
|
|
public class Partie extends JComponent {
|
|
private Color fond;
|
|
private Color triangle;
|
|
|
|
public Partie(Color fond, Color triangle){
|
|
this.fond = fond;
|
|
this.triangle = triangle;
|
|
}
|
|
|
|
@Override
|
|
public void paintComponent(Graphics pinceau) {
|
|
Graphics secondPinceau = pinceau.create();
|
|
secondPinceau.setColor(this.fond);
|
|
secondPinceau.fillRect(0,0,1000,1000);
|
|
secondPinceau.setColor(this.triangle);
|
|
int[] x = null;
|
|
x = new int[] {150,100,175};
|
|
int[] y = null;
|
|
y = new int[] {100,150,175};
|
|
secondPinceau.fillPolygon(x,y,3);
|
|
}
|
|
} |