Highlight current player's panel.

This commit is contained in:
rkfg 2016-03-20 18:42:46 +03:00
parent b6aa5ba5d5
commit 66a9e5140a
2 changed files with 30 additions and 6 deletions

View file

@ -22,7 +22,8 @@ public class MageRoundPane extends JPanel {
private int X_OFFSET = 30;
private int Y_OFFSET = 30;
private BufferedImage shadow = null;
private final Color backgroundColor = new Color(255, 255, 255, 200);
private final Color defaultBackgroundColor = new Color(255, 255, 255, 200);
private Color backgroundColor = defaultBackgroundColor;
private final int alpha = 0;
@Override
@ -99,6 +100,14 @@ public class MageRoundPane extends JPanel {
setVisible(bShow);
}
public void resetBackgroundColor() {
this.backgroundColor = defaultBackgroundColor;
}
public void setBackgroundColor(Color backgroundColor) {
this.backgroundColor = backgroundColor;
}
/**
* Default UID.
*/

View file

@ -105,6 +105,7 @@ public class PlayerPanelExt extends javax.swing.JPanel {
private static final Border GREEN_BORDER = new LineBorder(Color.green, 3);
private static final Border RED_BORDER = new LineBorder(Color.red, 2);
private static final Border EMPTY_BORDER = BorderFactory.createEmptyBorder(0, 0, 0, 0);
private final Color greenBackgroundColor = new Color(180, 255, 180);
private int avatarId = -1;
private String flagName;
@ -268,17 +269,31 @@ public class PlayerPanelExt extends javax.swing.JPanel {
if (player.isActive()) {
this.avatar.setBorder(GREEN_BORDER);
this.btnPlayer.setBorder(GREEN_BORDER);
} else if (player.hasLeft()) {
this.avatar.setBorder(RED_BORDER);
this.btnPlayer.setBorder(RED_BORDER);
setGreenBackgroundColor();
} else {
this.avatar.setBorder(EMPTY_BORDER);
this.btnPlayer.setBorder(EMPTY_BORDER);
resetBackgroundColor();
if (player.hasLeft()) {
this.avatar.setBorder(RED_BORDER);
this.btnPlayer.setBorder(RED_BORDER);
} else {
this.avatar.setBorder(EMPTY_BORDER);
this.btnPlayer.setBorder(EMPTY_BORDER);
}
}
update(player.getManaPool());
}
private void resetBackgroundColor() {
panelBackground.resetBackgroundColor();
zonesPanel.setBackground(null);
}
private void setGreenBackgroundColor() {
panelBackground.setBackgroundColor(greenBackgroundColor);
zonesPanel.setBackground(greenBackgroundColor);
}
/**
* Updates the avatar image and tooltip text
*/