22 lines
506 B
Java
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);
|
||
|
}
|
||
|
}
|