APL/DEV 3.2/TP02/Flocon/FloconPanel.java
2022-10-12 13:29:36 +02:00

22 lines
506 B
Java

import javax.swing.JPanel;
import java.awt.*;
public class FloconPanel extends JPanel {
private Polygon p;
public FloconPanel(Polygon p) {
this.p = p;
}
@Override
protected void paintComponent(Graphics g) {
Graphics gg = g;
if (this.isOpaque()) {
gg.setColor(this.getBackground());
gg.fillRect(this.getX(), this.getY(), this.getWidth(), this.getHeight());
}
gg.setColor(Color.black);
gg.drawPolygon(p);
}
}