1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25
|
package rev;
import java.awt.Color;
import java.awt.Graphics;
import java.awt.Polygon;
import javax.swing.JPanel;
public class PanneauGauche extends JPanel {
PanneauGauche(){
this.setBackground(Color.blue);
}
public void paintComponent(Graphics g){
super.paintComponent(g);
int xPoly[]={10,50,90};
int yPoly[]={150,250,150};
Polygon poly = new Polygon(xPoly, yPoly, xPoly.length);
g.drawRect(10, 10, 50, 50);
g.drawOval(10, 70, 50, 50);
g.drawPolygon(poly);
}
} |
Partager