Ajout transparence pion pas encore placé

This commit is contained in:
Justine Yannis 2022-10-24 13:32:08 +02:00
parent 5d59d8a151
commit 921698c2c8

View File

@ -2,9 +2,8 @@ package fr.iutfbleau.projetAgile.Puissance4.View;
import java.awt.*;
import javax.swing.*;
import fr.iutfbleau.projetAgile.Puissance4.Utils.Constants;
import fr.iutfbleau.projetAgile.Puissance4.Utils.Constants;
import fr.iutfbleau.projetAgile.Puissance4.Utils.Constants;
public class Pion extends JComponent{
@ -64,10 +63,13 @@ public class Pion extends JComponent{
break;
}
if(this.hover) {
g2.setColor(Pion.HIGHLIGHT_COLOR);
g2.fillRect(0, 0, this.getWidth(), this.getHeight());
g2.setColor(new Color(Pion.HIGHLIGHT_COLOR.getRed(),Pion.HIGHLIGHT_COLOR.getGreen(),Pion.HIGHLIGHT_COLOR.getBlue(), 100));
g2.fillOval(Constants.PIECE_MARGIN, Constants.PIECE_MARGIN, this.getWidth() - 2 * Constants.PIECE_MARGIN, this.getHeight() - 2 * Constants.PIECE_MARGIN);
}
g2.setColor(c);
g2.fillOval(Constants.PIECE_MARGIN, Constants.PIECE_MARGIN, this.getWidth() - 2 * Constants.PIECE_MARGIN, this.getHeight() - 2 * Constants.PIECE_MARGIN);
else {
g2.setColor(c);
g2.fillOval(Constants.PIECE_MARGIN, Constants.PIECE_MARGIN, this.getWidth() - 2 * Constants.PIECE_MARGIN, this.getHeight() - 2 * Constants.PIECE_MARGIN);
}
}
}