23 lines
902 B
Java
23 lines
902 B
Java
import java.awt.*;
|
|
import javax.swing.*;
|
|
|
|
public class Pion extends JComponent{
|
|
|
|
public Pion() {
|
|
this.setMinimumSize(new Dimension(80,80));
|
|
this.setMaximumSize(new Dimension(150,150));
|
|
this.setPreferredSize(new Dimension(120,120));
|
|
this.setBackground(Color.WHITE);
|
|
}
|
|
|
|
@Override
|
|
protected void paintComponent(Graphics g) {
|
|
Graphics g2 = g.create();
|
|
//g2.setColor(Color.BLUE);
|
|
//g2.fillRect(0, 0, this.getWidth(), this.getHeight());
|
|
g2.setColor(Color.GRAY);
|
|
g2.fillOval((int) (Utils.PAWN_MARGIN * 1.2),(int) (Utils.PAWN_MARGIN * 1.1) , this.getWidth() - 2 * Utils.PAWN_MARGIN, this.getHeight() - 2 * Utils.PAWN_MARGIN + 2);
|
|
g2.setColor(this.getBackground());
|
|
g2.fillOval(Utils.PAWN_MARGIN, Utils.PAWN_MARGIN, this.getWidth() - 2 * Utils.PAWN_MARGIN, this.getHeight() - 2 * Utils.PAWN_MARGIN);
|
|
}
|
|
} |