use of mage.client.components.HoverButton in project mage by magefree.
the class MageBook method initComponents.
private void initComponents() {
setOpaque(false);
setSize(conf.WIDTH, conf.HEIGHT);
setPreferredSize(new Dimension(conf.WIDTH, conf.HEIGHT));
setMinimumSize(new Dimension(conf.WIDTH, conf.HEIGHT));
jPanelLeft = getImagePanel(LEFT_PANEL_IMAGE_PATH, ImagePanelStyle.TILED);
jPanelLeft.setPreferredSize(new Dimension(LEFT_RIGHT_PAGES_WIDTH, 0));
jPanelLeft.setLayout(null);
jPanelCenter = getImagePanel(CENTER_PANEL_IMAGE_PATH, ImagePanelStyle.SCALED);
jPanelCenter.setLayout(new BorderLayout());
jPanelRight = getImagePanel(RIGHT_PANEL_IMAGE_PATH, ImagePanelStyle.TILED);
jPanelRight.setPreferredSize(new Dimension(LEFT_RIGHT_PAGES_WIDTH, 0));
jPanelRight.setLayout(null);
jLayeredPane = new JLayeredPane();
jPanelCenter.add(jLayeredPane, BorderLayout.CENTER);
Image image = ImageHelper.loadImage(LEFT_PAGE_BUTTON_IMAGE_PATH);
pageLeft = new HoverButton(null, image, image, image, new Rectangle(64, 64));
pageLeft.setBounds(0, 0, 64, 64);
pageLeft.setVisible(false);
pageLeft.setObserver(() -> {
currentPage--;
if (currentPage == 0) {
pageLeft.setVisible(false);
}
pageRight.setVisible(true);
AudioManager.playPrevPage();
showCardsOrTokens();
});
image = ImageHelper.loadImage(RIGHT_PAGE_BUTTON_IMAGE_PATH);
pageRight = new HoverButton(null, image, image, image, new Rectangle(64, 64));
pageRight.setBounds(conf.WIDTH - 2 * LEFT_RIGHT_PAGES_WIDTH - 64, 0, 64, 64);
pageRight.setVisible(false);
pageRight.setObserver(() -> {
currentPage++;
pageLeft.setVisible(true);
pageRight.setVisible(false);
AudioManager.playNextPage();
showCardsOrTokens();
});
addSetTabs();
setLayout(new BorderLayout());
add(jPanelLeft, BorderLayout.LINE_START);
add(jPanelCenter, BorderLayout.CENTER);
add(jPanelRight, BorderLayout.LINE_END);
// caption size = next-prev images
int captionHeight = Math.max(30, pageLeft.getHeight());
// Top Panel (left page + (caption / stats) + right page
jPanelTop = new JPanel();
jPanelTop.setLayout(new BorderLayout());
jPanelTop.setPreferredSize(new Dimension(captionHeight, captionHeight));
jPanelCenter.add(jPanelTop, BorderLayout.NORTH);
// page left
pageRight.setPreferredSize(new Dimension(pageRight.getWidth(), pageRight.getHeight()));
jPanelTop.add(pageRight, BorderLayout.EAST);
// page right
pageLeft.setPreferredSize(new Dimension(pageLeft.getWidth(), pageLeft.getHeight()));
jPanelTop.add(pageLeft, BorderLayout.WEST);
// Caption Panel
jPanelCaption = new JPanel();
jPanelCaption.setLayout(new BorderLayout());
jPanelCaption.setOpaque(false);
jPanelTop.add(jPanelCaption, BorderLayout.CENTER);
// set's caption
setCaption = new JLabel();
setCaption.setHorizontalAlignment(SwingConstants.CENTER);
setCaption.setFont(jLayeredPane.getFont().deriveFont(25f));
setCaption.setText("EMPTY CAPTION");
jPanelCaption.add(setCaption, BorderLayout.NORTH);
// set's info
setInfo = new JLabel();
setInfo.setHorizontalAlignment(SwingConstants.CENTER);
setInfo.setFont(jLayeredPane.getFont().deriveFont(17f));
setInfo.setText("EMPTY STATS");
jPanelCaption.add(setInfo, BorderLayout.SOUTH);
cardDimensions = new CardDimensions(0.45d);
}
use of mage.client.components.HoverButton in project mage by magefree.
the class MageBook method addSetTabs.
private void addSetTabs() {
jPanelLeft.removeAll();
jPanelRight.removeAll();
tabs.clear();
Image image = ImageHelper.loadImage(LEFT_TAB_IMAGE_PATH);
Image imageRight = ImageHelper.loadImage(RIGHT_TAB_IMAGE_PATH);
int y = 0;
int dy = 0;
if (this.setsToDisplay.size() > 1) {
dy = (conf.HEIGHT - 120) / (this.setsToDisplay.size() - 1) + 1;
}
int count = 0;
JPanel currentPanel = jPanelLeft;
HoverButton currentTab = null;
for (String set : this.setsToDisplay) {
HoverButton tab = new HoverButton(null, image, image, image, new Rectangle(39, 120));
Image setImage = ManaSymbols.getSetSymbolImage(set);
if (setImage != null) {
tab.setOverlayImage(setImage);
}
tab.setSet(set);
tab.setBounds(0, y, 39, 120);
final String _set = set;
final int _index = count;
tab.setObserver(() -> {
if (!currentSet.equals(_set) || currentPage != 0 || stateChanged) {
AudioManager.playAnotherTab();
synchronized (MageBook.this) {
selectedTab = _index;
}
currentPage = 0;
currentSet = _set;
pageLeft.setVisible(false);
pageRight.setVisible(false);
addSetTabs();
showCardsOrTokens();
}
});
tabs.add(tab);
currentPanel.add(tab, JLayeredPane.DEFAULT_LAYER + count++, 0);
y += dy;
if (set.equals(currentSet)) {
currentPanel = jPanelRight;
image = imageRight;
currentTab = tab;
selectedTab = count - 1;
}
}
jPanelLeft.revalidate();
jPanelLeft.repaint();
jPanelRight.revalidate();
jPanelRight.repaint();
if (currentTab != null) {
currentTab.drawSet();
currentTab.repaint();
}
}
use of mage.client.components.HoverButton in project mage by magefree.
the class ChoiceDialog method getJButtonOK.
private HoverButton getJButtonOK() {
if (jButtonOK == null) {
jButtonOK = new HoverButton("", ImageManagerImpl.instance.getDlgAcceptButtonImage(), ImageManagerImpl.instance.getDlgActiveAcceptButtonImage(), ImageManagerImpl.instance.getDlgAcceptButtonImage(), new Rectangle(60, 60));
int w = getDlgParams().rect.width - 75;
int h = getDlgParams().rect.height - 90;
jButtonOK.setBounds(new Rectangle(w / 2 - 40, h - 50, 60, 60));
jButtonOK.setToolTipText("Ok");
jButtonOK.setObserver(() -> DialogManager.getManager(gameId).fadeOut((DialogContainer) getParent()));
}
return jButtonOK;
}
use of mage.client.components.HoverButton in project mage by magefree.
the class PlayerPanelExt method initComponents.
/**
* This method is called from within the constructor to initialize the form.
* WARNING: Do NOT modify this code. The content of this method is always
* regenerated by the Form Editor.
*/
@SuppressWarnings("unchecked")
private // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
void initComponents() {
panelBackground = new MageRoundPane();
panelBackground.setPreferredSize(new Dimension(PANEL_WIDTH - 2, PANEL_HEIGHT));
Rectangle r = new Rectangle(80, 80);
// avatarFlag = new JLabel();
// monarchIcon = new JLabel();
timerLabel = new JLabel();
lifeLabel = new JLabel();
handLabel = new JLabel();
poisonLabel = new JLabel();
energyLabel = new JLabel();
experienceLabel = new JLabel();
graveLabel = new JLabel();
commandLabel = new JLabel();
libraryLabel = new JLabel();
setOpaque(false);
panelBackground.setXOffset(3);
panelBackground.setYOffset(3);
panelBackground.setVisible(true);
// Avatar
Image image = ImageHelper.getImageFromResources(DEFAULT_AVATAR_PATH);
BufferedImage resized = ImageHelper.getResizedImage(BufferedImageBuilder.bufferImage(image, BufferedImage.TYPE_INT_ARGB), r);
avatar = new HoverButton("", resized, resized, resized, r);
String showPlayerNamePermanently = MageFrame.getPreferences().get(PreferencesDialog.KEY_SHOW_PLAYER_NAMES_PERMANENTLY, "true");
if (showPlayerNamePermanently.equals("true")) {
avatar.setTextAlwaysVisible(true);
}
avatar.setTextOffsetButtonY(10);
avatar.setObserver(() -> SessionHandler.sendPlayerUUID(gameId, playerId));
// timer area /small layout)
timerLabel.setToolTipText("Time left");
timerLabel.setSize(80, 12);
timerLabel.setHorizontalAlignment(SwingConstants.CENTER);
// life area
r = new Rectangle(18, 18);
lifeLabel.setToolTipText("Life");
Image imageLife = ImageHelper.getImageFromResources("/info/life.png");
BufferedImage resizedLife = ImageHelper.getResizedImage(BufferedImageBuilder.bufferImage(imageLife, BufferedImage.TYPE_INT_ARGB), r);
life = new ImagePanel(resizedLife, ImagePanelStyle.ACTUAL);
life.setToolTipText("Life");
life.setOpaque(false);
// hand area
r = new Rectangle(18, 18);
handLabel.setToolTipText("Hand");
Image imageHand = ImageHelper.getImageFromResources("/info/hand.png");
BufferedImage resizedHand = ImageHelper.getResizedImage(BufferedImageBuilder.bufferImage(imageHand, BufferedImage.TYPE_INT_ARGB), r);
hand = new ImagePanel(resizedHand, ImagePanelStyle.ACTUAL);
hand.setToolTipText("Hand");
hand.setOpaque(false);
// Poison count
r = new Rectangle(18, 18);
Image imagePoison = ImageHelper.getImageFromResources("/info/poison.png");
BufferedImage resizedPoison = ImageHelper.getResizedImage(BufferedImageBuilder.bufferImage(imagePoison, BufferedImage.TYPE_INT_ARGB), r);
poison = new ImagePanel(resizedPoison, ImagePanelStyle.ACTUAL);
poison.setOpaque(false);
setTextForLabel("poison", poisonLabel, poison, 0, false);
// Library
r = new Rectangle(19, 19);
libraryLabel.setToolTipText("Library");
Image imageLibrary = ImageHelper.getImageFromResources("/info/library.png");
BufferedImage resizedLibrary = ImageHelper.getResizedImage(BufferedImageBuilder.bufferImage(imageLibrary, BufferedImage.TYPE_INT_ARGB), r);
library = new HoverButton(null, resizedLibrary, resizedLibrary, resizedLibrary, r);
library.setToolTipText("Library");
library.setOpaque(false);
library.setObserver(() -> btnLibraryActionPerformed(null));
// Grave count and open graveyard button
r = new Rectangle(21, 21);
graveLabel.setToolTipText("Card Types: 0");
Image imageGrave = ImageHelper.getImageFromResources("/info/grave.png");
BufferedImage resizedGrave = ImageHelper.getResizedImage(BufferedImageBuilder.bufferImage(imageGrave, BufferedImage.TYPE_INT_ARGB), r);
grave = new HoverButton(null, resizedGrave, resizedGrave, resizedGrave, r);
grave.setToolTipText("Graveyard");
grave.setOpaque(false);
grave.setObserver(() -> btnGraveActionPerformed(null));
exileLabel = new JLabel();
exileLabel.setToolTipText("Exile");
image = ImageHelper.getImageFromResources("/info/exile.png");
r = new Rectangle(21, 21);
resized = ImageHelper.getResizedImage(BufferedImageBuilder.bufferImage(image, BufferedImage.TYPE_INT_ARGB), r);
exileZone = new HoverButton(null, resized, resized, resized, r);
exileZone.setToolTipText("Exile");
exileZone.setOpaque(false);
exileZone.setObserver(() -> btnExileZoneActionPerformed(null));
exileZone.setBounds(25, 0, 21, 21);
// Cheat button
r = new Rectangle(25, 21);
image = ImageHelper.getImageFromResources("/info/cheat.png");
resized = ImageHelper.getResizedImage(BufferedImageBuilder.bufferImage(image, BufferedImage.TYPE_INT_ARGB), r);
cheat = new JButton();
cheat.setIcon(new ImageIcon(resized));
cheat.setToolTipText("Cheat button");
cheat.addActionListener(e -> btnCheatActionPerformed(e));
zonesPanel = new JPanel();
zonesPanel.setPreferredSize(new Dimension(100, 60));
zonesPanel.setSize(100, 60);
zonesPanel.setLayout(null);
zonesPanel.setOpaque(false);
image = ImageHelper.getImageFromResources("/info/command_zone.png");
r = new Rectangle(21, 21);
resized = ImageHelper.getResizedImage(BufferedImageBuilder.bufferImage(image, BufferedImage.TYPE_INT_ARGB), r);
commandZone = new HoverButton(null, resized, resized, resized, r);
commandZone.setToolTipText("Command Zone (Commanders, Emblems and Planes)");
commandZone.setOpaque(false);
commandZone.setObserver(() -> btnCommandZoneActionPerformed(null));
commandZone.setBounds(3, 0, 21, 21);
zonesPanel.add(commandZone);
commandLabel.setToolTipText("Command zone");
commandLabel.setBounds(25, 0, 21, 21);
zonesPanel.add(commandLabel);
cheat.setBounds(40, 2, 25, 21);
zonesPanel.add(cheat);
energyExperiencePanel = new JPanel();
energyExperiencePanel.setPreferredSize(new Dimension(100, 20));
energyExperiencePanel.setSize(100, 20);
energyExperiencePanel.setLayout(null);
energyExperiencePanel.setOpaque(false);
// Energy count
r = new Rectangle(18, 18);
Image imageEnergy = ImageHelper.getImageFromResources("/info/energy.png");
BufferedImage resizedEnergy = ImageHelper.getResizedImage(BufferedImageBuilder.bufferImage(imageEnergy, BufferedImage.TYPE_INT_ARGB), r);
energy = new ImagePanel(resizedEnergy, ImagePanelStyle.ACTUAL);
energy.setToolTipText("Energy");
energy.setOpaque(false);
setTextForLabel("energy", energyLabel, energy, 0, false);
// Experience count
r = new Rectangle(18, 18);
Image imageExperience = ImageHelper.getImageFromResources("/info/experience.png");
BufferedImage resizedExperience = ImageHelper.getResizedImage(BufferedImageBuilder.bufferImage(imageExperience, BufferedImage.TYPE_INT_ARGB), r);
experience = new ImagePanel(resizedExperience, ImagePanelStyle.ACTUAL);
experience.setToolTipText("Experience");
experience.setOpaque(false);
setTextForLabel("experience", experienceLabel, experience, 0, false);
btnPlayer = new JButton();
btnPlayer.setText("Player");
btnPlayer.setVisible(false);
btnPlayer.setToolTipText("Player");
btnPlayer.addActionListener(e -> SessionHandler.sendPlayerUUID(gameId, playerId));
// Add mana symbols
// TODO: replace "button + label" to label on rework
/*
MouseAdapter manaMouseAdapter = new MouseAdapter() {
@Override
public void mouseClicked(MouseEvent evt) {
JLabel label = (JLabel) evt.getSource();
if (manaLabels.containsKey(label)) {
btnManaActionPerformed(manaLabels.get(label));
}
}
};
JLabel manaCountLabelW = new JLabel();
manaCountLabelW.setToolTipText("White mana");
setTextForLabel(manaCountLabelW, 0, false);
manaCountLabelW.setIcon(new ImageIcon(ManaSymbols.getSizedManaSymbol("W", 15)));
manaCountLabelW.addMouseListener(manaMouseAdapter);
manaLabels.put(manaCountLabelW, ManaType.WHITE);l
//*/
// /*
JLabel manaCountLabelW = new JLabel();
manaLabels.put(manaCountLabelW, ManaType.WHITE);
r = new Rectangle(15, 15);
BufferedImage imageManaW = ManaSymbols.getSizedManaSymbol("W", 15);
HoverButton btnWhiteMana = new HoverButton(null, imageManaW, imageManaW, imageManaW, r);
btnWhiteMana.setOpaque(false);
btnWhiteMana.setObserver(() -> btnManaActionPerformed(ManaType.WHITE));
manaButtons.put(manaCountLabelW, btnWhiteMana);
setTextForLabel(ManaType.WHITE.toString() + " mana", manaCountLabelW, btnWhiteMana, 0, false);
// */
JLabel manaCountLabelU = new JLabel();
manaLabels.put(manaCountLabelU, ManaType.BLUE);
r = new Rectangle(15, 15);
BufferedImage imageManaU = ManaSymbols.getSizedManaSymbol("U", 15);
HoverButton btnBlueMana = new HoverButton(null, imageManaU, imageManaU, imageManaU, r);
btnBlueMana.setOpaque(false);
btnBlueMana.setObserver(() -> btnManaActionPerformed(ManaType.BLUE));
manaButtons.put(manaCountLabelU, btnBlueMana);
setTextForLabel(ManaType.BLUE.toString() + " mana", manaCountLabelU, btnBlueMana, 0, false);
JLabel manaCountLabelB = new JLabel();
manaLabels.put(manaCountLabelB, ManaType.BLACK);
r = new Rectangle(15, 15);
BufferedImage imageManaB = ManaSymbols.getSizedManaSymbol("B", 15);
HoverButton btnBlackMana = new HoverButton(null, imageManaB, imageManaB, imageManaB, r);
btnBlackMana.setOpaque(false);
btnBlackMana.setObserver(() -> btnManaActionPerformed(ManaType.BLACK));
manaButtons.put(manaCountLabelB, btnBlackMana);
setTextForLabel(ManaType.BLACK.toString() + " mana", manaCountLabelB, btnBlackMana, 0, false);
JLabel manaCountLabelR = new JLabel();
manaLabels.put(manaCountLabelR, ManaType.RED);
r = new Rectangle(15, 15);
BufferedImage imageManaR = ManaSymbols.getSizedManaSymbol("R", 15);
HoverButton btnRedMana = new HoverButton(null, imageManaR, imageManaR, imageManaR, r);
btnRedMana.setOpaque(false);
btnRedMana.setObserver(() -> btnManaActionPerformed(ManaType.RED));
manaButtons.put(manaCountLabelR, btnRedMana);
setTextForLabel(ManaType.RED.toString() + " mana", manaCountLabelR, btnRedMana, 0, false);
JLabel manaCountLabelG = new JLabel();
manaLabels.put(manaCountLabelG, ManaType.GREEN);
r = new Rectangle(15, 15);
BufferedImage imageManaG = ManaSymbols.getSizedManaSymbol("G", 15);
HoverButton btnGreenMana = new HoverButton(null, imageManaG, imageManaG, imageManaG, r);
btnGreenMana.setOpaque(false);
btnGreenMana.setObserver(() -> btnManaActionPerformed(ManaType.GREEN));
manaButtons.put(manaCountLabelG, btnGreenMana);
setTextForLabel(ManaType.GREEN.toString() + " mana", manaCountLabelG, btnGreenMana, 0, false);
JLabel manaCountLabelX = new JLabel();
manaLabels.put(manaCountLabelX, ManaType.COLORLESS);
r = new Rectangle(15, 15);
BufferedImage imageManaX = ManaSymbols.getSizedManaSymbol("C", 15);
HoverButton btnColorlessMana = new HoverButton(null, imageManaX, imageManaX, imageManaX, r);
btnColorlessMana.setOpaque(false);
btnColorlessMana.setObserver(() -> btnManaActionPerformed(ManaType.COLORLESS));
manaButtons.put(manaCountLabelX, btnColorlessMana);
setTextForLabel(ManaType.COLORLESS.toString() + " mana", manaCountLabelX, btnColorlessMana, 0, false);
GroupLayout gl_panelBackground = new GroupLayout(panelBackground);
gl_panelBackground.setHorizontalGroup(gl_panelBackground.createParallelGroup(Alignment.LEADING).addGroup(gl_panelBackground.createSequentialGroup().addGap(9).addComponent(life, GroupLayout.PREFERRED_SIZE, 18, GroupLayout.PREFERRED_SIZE).addGap(3).addGroup(gl_panelBackground.createParallelGroup(Alignment.LEADING).addGroup(gl_panelBackground.createSequentialGroup().addGap(18).addComponent(hand, GroupLayout.PREFERRED_SIZE, 18, GroupLayout.PREFERRED_SIZE)).addComponent(lifeLabel, GroupLayout.PREFERRED_SIZE, 25, GroupLayout.PREFERRED_SIZE)).addGap(4).addComponent(handLabel, GroupLayout.PREFERRED_SIZE, 20, GroupLayout.PREFERRED_SIZE)).addGroup(gl_panelBackground.createSequentialGroup().addGap(9).addComponent(poison, GroupLayout.PREFERRED_SIZE, 18, GroupLayout.PREFERRED_SIZE).addGap(3).addGroup(gl_panelBackground.createParallelGroup(Alignment.LEADING).addGroup(gl_panelBackground.createSequentialGroup().addGap(18).addComponent(library, GroupLayout.PREFERRED_SIZE, 18, GroupLayout.PREFERRED_SIZE)).addComponent(poisonLabel, GroupLayout.PREFERRED_SIZE, 25, GroupLayout.PREFERRED_SIZE)).addGap(4).addComponent(libraryLabel, GroupLayout.PREFERRED_SIZE, 20, GroupLayout.PREFERRED_SIZE)).addGroup(gl_panelBackground.createSequentialGroup().addGap(9).addGroup(gl_panelBackground.createParallelGroup(Alignment.LEADING).addGroup(gl_panelBackground.createSequentialGroup().addComponent(energy, GroupLayout.PREFERRED_SIZE, 18, GroupLayout.PREFERRED_SIZE)).addGroup(gl_panelBackground.createSequentialGroup().addGap(2).addComponent(btnWhiteMana, GroupLayout.PREFERRED_SIZE, 15, GroupLayout.PREFERRED_SIZE)).addGroup(gl_panelBackground.createSequentialGroup().addGap(2).addComponent(btnBlueMana, GroupLayout.PREFERRED_SIZE, 15, GroupLayout.PREFERRED_SIZE)).addGroup(gl_panelBackground.createSequentialGroup().addGap(2).addComponent(btnBlackMana, GroupLayout.PREFERRED_SIZE, 15, GroupLayout.PREFERRED_SIZE)).addComponent(grave, GroupLayout.PREFERRED_SIZE, 21, GroupLayout.PREFERRED_SIZE)).addGroup(gl_panelBackground.createParallelGroup(Alignment.LEADING).addGroup(gl_panelBackground.createSequentialGroup().addGroup(gl_panelBackground.createParallelGroup(Alignment.LEADING).addGroup(gl_panelBackground.createSequentialGroup().addGap(18).addComponent(experience, GroupLayout.PREFERRED_SIZE, 19, GroupLayout.PREFERRED_SIZE)).addComponent(energyLabel, GroupLayout.PREFERRED_SIZE, 20, GroupLayout.PREFERRED_SIZE).addGroup(gl_panelBackground.createSequentialGroup().addGap(20).addComponent(btnRedMana, GroupLayout.PREFERRED_SIZE, 15, GroupLayout.PREFERRED_SIZE)).addGroup(gl_panelBackground.createSequentialGroup().addGap(1).addComponent(manaCountLabelW, GroupLayout.PREFERRED_SIZE, MANA_LABEL_SIZE_HORIZONTAL, GroupLayout.PREFERRED_SIZE))).addGap(3).addComponent(manaCountLabelR, GroupLayout.PREFERRED_SIZE, MANA_LABEL_SIZE_HORIZONTAL, GroupLayout.PREFERRED_SIZE)).addGroup(gl_panelBackground.createSequentialGroup().addGap(1).addGroup(gl_panelBackground.createParallelGroup(Alignment.LEADING).addComponent(manaCountLabelB, GroupLayout.PREFERRED_SIZE, MANA_LABEL_SIZE_HORIZONTAL, GroupLayout.PREFERRED_SIZE).addGroup(gl_panelBackground.createSequentialGroup().addGap(19).addComponent(btnColorlessMana, GroupLayout.PREFERRED_SIZE, 15, GroupLayout.PREFERRED_SIZE))).addGap(5).addComponent(manaCountLabelX, GroupLayout.PREFERRED_SIZE, MANA_LABEL_SIZE_HORIZONTAL, GroupLayout.PREFERRED_SIZE)).addGroup(gl_panelBackground.createSequentialGroup().addGap(20).addComponent(btnGreenMana, GroupLayout.PREFERRED_SIZE, 15, GroupLayout.PREFERRED_SIZE)).addGroup(gl_panelBackground.createSequentialGroup().addGap(40).addComponent(manaCountLabelG, GroupLayout.PREFERRED_SIZE, MANA_LABEL_SIZE_HORIZONTAL, GroupLayout.PREFERRED_SIZE)).addGroup(gl_panelBackground.createSequentialGroup().addGap(40).addComponent(experienceLabel, GroupLayout.PREFERRED_SIZE, 25, GroupLayout.PREFERRED_SIZE)).addGroup(gl_panelBackground.createSequentialGroup().addGap(18).addComponent(exileZone, GroupLayout.PREFERRED_SIZE, 25, GroupLayout.PREFERRED_SIZE)).addGroup(gl_panelBackground.createSequentialGroup().addGap(5).addComponent(graveLabel, GroupLayout.PREFERRED_SIZE, 25, GroupLayout.PREFERRED_SIZE)).addGroup(gl_panelBackground.createSequentialGroup().addGap(40).addComponent(exileLabel, GroupLayout.PREFERRED_SIZE, 25, GroupLayout.PREFERRED_SIZE)).addGroup(gl_panelBackground.createSequentialGroup().addGap(1).addComponent(manaCountLabelU, GroupLayout.PREFERRED_SIZE, MANA_LABEL_SIZE_HORIZONTAL, GroupLayout.PREFERRED_SIZE)))).addGroup(gl_panelBackground.createSequentialGroup().addGap(6).addGroup(gl_panelBackground.createParallelGroup(Alignment.LEADING).addComponent(btnPlayer, Alignment.TRAILING, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE).addComponent(timerLabel, Alignment.TRAILING, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE).addComponent(avatar, Alignment.TRAILING, GroupLayout.DEFAULT_SIZE, 80, Short.MAX_VALUE)).addGap(8)).addGroup(gl_panelBackground.createSequentialGroup().addGap(6).addComponent(zonesPanel, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE).addGap(14)));
gl_panelBackground.setVerticalGroup(gl_panelBackground.createParallelGroup(Alignment.LEADING).addGroup(gl_panelBackground.createSequentialGroup().addGap(6).addComponent(avatar, GroupLayout.PREFERRED_SIZE, 80, GroupLayout.PREFERRED_SIZE).addPreferredGap(ComponentPlacement.RELATED).addComponent(btnPlayer).addComponent(timerLabel).addGap(2).addGroup(gl_panelBackground.createParallelGroup(Alignment.LEADING).addGroup(gl_panelBackground.createSequentialGroup().addGap(1).addComponent(life, GroupLayout.PREFERRED_SIZE, 18, GroupLayout.PREFERRED_SIZE)).addGroup(gl_panelBackground.createSequentialGroup().addGap(1).addComponent(hand, GroupLayout.PREFERRED_SIZE, 18, GroupLayout.PREFERRED_SIZE)).addComponent(lifeLabel, GroupLayout.PREFERRED_SIZE, 20, GroupLayout.PREFERRED_SIZE).addComponent(handLabel, GroupLayout.PREFERRED_SIZE, 20, GroupLayout.PREFERRED_SIZE)).addGroup(gl_panelBackground.createParallelGroup(Alignment.LEADING).addGroup(gl_panelBackground.createSequentialGroup().addGap(1).addComponent(poison, GroupLayout.PREFERRED_SIZE, 18, GroupLayout.PREFERRED_SIZE)).addGroup(gl_panelBackground.createSequentialGroup().addGap(1).addComponent(library, GroupLayout.PREFERRED_SIZE, 18, GroupLayout.PREFERRED_SIZE)).addComponent(poisonLabel, GroupLayout.PREFERRED_SIZE, 20, GroupLayout.PREFERRED_SIZE).addComponent(libraryLabel, GroupLayout.PREFERRED_SIZE, 20, GroupLayout.PREFERRED_SIZE)).addGap(1).addGroup(gl_panelBackground.createParallelGroup(Alignment.LEADING).addGroup(gl_panelBackground.createSequentialGroup().addGap(2).addComponent(energy, GroupLayout.PREFERRED_SIZE, 18, GroupLayout.PREFERRED_SIZE).addGap(2).addComponent(btnWhiteMana, GroupLayout.PREFERRED_SIZE, 15, GroupLayout.PREFERRED_SIZE).addGap(2).addComponent(btnBlueMana, GroupLayout.PREFERRED_SIZE, 15, GroupLayout.PREFERRED_SIZE).addGap(2).addComponent(btnBlackMana, GroupLayout.PREFERRED_SIZE, 15, GroupLayout.PREFERRED_SIZE).addGap(3).addComponent(grave, GroupLayout.PREFERRED_SIZE, 21, GroupLayout.PREFERRED_SIZE)).addGroup(gl_panelBackground.createSequentialGroup().addGroup(gl_panelBackground.createParallelGroup(Alignment.LEADING).addGroup(gl_panelBackground.createSequentialGroup().addGroup(gl_panelBackground.createParallelGroup(Alignment.LEADING).addGroup(gl_panelBackground.createSequentialGroup().addGap(1).addComponent(experience, GroupLayout.PREFERRED_SIZE, 19, GroupLayout.PREFERRED_SIZE)).addComponent(energyLabel, GroupLayout.PREFERRED_SIZE, 20, GroupLayout.PREFERRED_SIZE)).addGap(2).addComponent(btnRedMana, GroupLayout.PREFERRED_SIZE, 15, GroupLayout.PREFERRED_SIZE)).addGroup(gl_panelBackground.createSequentialGroup().addGap(14).addComponent(manaCountLabelW, GroupLayout.PREFERRED_SIZE, 30, GroupLayout.PREFERRED_SIZE)).addGroup(gl_panelBackground.createSequentialGroup().addGap(14).addComponent(manaCountLabelR, GroupLayout.PREFERRED_SIZE, 30, GroupLayout.PREFERRED_SIZE))).addGap(4).addGroup(gl_panelBackground.createParallelGroup(Alignment.LEADING).addComponent(manaCountLabelB, GroupLayout.PREFERRED_SIZE, 30, GroupLayout.PREFERRED_SIZE).addGroup(gl_panelBackground.createSequentialGroup().addGap(8).addComponent(btnColorlessMana, GroupLayout.PREFERRED_SIZE, 15, GroupLayout.PREFERRED_SIZE)).addComponent(manaCountLabelX, GroupLayout.PREFERRED_SIZE, 30, GroupLayout.PREFERRED_SIZE))).addGroup(gl_panelBackground.createSequentialGroup().addGap(39).addComponent(btnGreenMana, GroupLayout.PREFERRED_SIZE, 15, GroupLayout.PREFERRED_SIZE)).addGroup(gl_panelBackground.createSequentialGroup().addGap(31).addComponent(manaCountLabelG, GroupLayout.PREFERRED_SIZE, 30, GroupLayout.PREFERRED_SIZE)).addComponent(experienceLabel, GroupLayout.PREFERRED_SIZE, 20, GroupLayout.PREFERRED_SIZE).addGroup(gl_panelBackground.createSequentialGroup().addGap(76).addComponent(exileZone, GroupLayout.PREFERRED_SIZE, 21, GroupLayout.PREFERRED_SIZE)).addGroup(gl_panelBackground.createSequentialGroup().addGap(76).addComponent(graveLabel, GroupLayout.PREFERRED_SIZE, 21, GroupLayout.PREFERRED_SIZE)).addGroup(gl_panelBackground.createSequentialGroup().addGap(76).addComponent(exileLabel, GroupLayout.PREFERRED_SIZE, 21, GroupLayout.PREFERRED_SIZE)).addGroup(gl_panelBackground.createSequentialGroup().addGap(31).addComponent(manaCountLabelU, GroupLayout.PREFERRED_SIZE, 30, GroupLayout.PREFERRED_SIZE))).addGap(2).addComponent(zonesPanel, GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE)));
panelBackground.setLayout(gl_panelBackground);
GroupLayout groupLayout = new GroupLayout(this);
groupLayout.setHorizontalGroup(groupLayout.createParallelGroup(Alignment.LEADING).addGroup(groupLayout.createSequentialGroup().addComponent(panelBackground, GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE)));
groupLayout.setVerticalGroup(groupLayout.createParallelGroup(Alignment.LEADING).addGroup(groupLayout.createSequentialGroup().addComponent(panelBackground, GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE)));
setLayout(groupLayout);
}
use of mage.client.components.HoverButton in project mage by magefree.
the class ReplayTask method createPhaseButton.
private void createPhaseButton(String name, MouseAdapter mouseAdapter) {
if (hoverButtons == null) {
hoverButtons = new LinkedHashMap<>();
}
Rectangle rect = new Rectangle(36, 36);
HoverButton button = new HoverButton("", ImageManagerImpl.instance.getPhaseImage(name), rect);
button.setToolTipText(name.replaceAll("_", " "));
button.setPreferredSize(new Dimension(36, 36));
button.addMouseListener(mouseAdapter);
hoverButtons.put(name, button);
}
Aggregations