use M-circle icon for menu button in game; remove dead MenuIconLabel class.
parent
f1e805da04
commit
d6bf081b34
Binary file not shown.
After Width: | Height: | Size: 518 B |
Binary file not shown.
Before Width: | Height: | Size: 200 B |
|
@ -39,12 +39,12 @@ public enum MagicIcon {
|
|||
LIFE("ui/w_life.png"),
|
||||
LOG_FILE("ui/w_log16.png"),
|
||||
MARKER("ui/w_marker.png"),
|
||||
MENU("ui/w_menu5@18.png"),
|
||||
MINUS_ICON("ui/w_minus28.png"),
|
||||
MULLIGAN("ui/w_mulligan.png"),
|
||||
OPEN("ui/w_open.png"),
|
||||
OPTIONS("ui/w_book.png"),
|
||||
OPTION_MENU("ui/m-circle-32.png"),
|
||||
OPTION_MENU_TINY("ui/m-circle-18.png"),
|
||||
PLANESWALKERS("ui/w_planeswalkers.png"),
|
||||
PLUS_ICON("ui/w_plus28.png"),
|
||||
POISON("ui/poison-16.png"),
|
||||
|
|
|
@ -1,84 +0,0 @@
|
|||
package magic.ui.widget;
|
||||
|
||||
import java.awt.Cursor;
|
||||
import java.awt.Rectangle;
|
||||
import java.awt.event.MouseAdapter;
|
||||
import java.awt.event.MouseEvent;
|
||||
import javax.swing.Icon;
|
||||
import javax.swing.ImageIcon;
|
||||
import javax.swing.JLabel;
|
||||
import javax.swing.JPopupMenu;
|
||||
import javax.swing.SwingUtilities;
|
||||
import magic.data.MagicIcon;
|
||||
import magic.ui.MagicImages;
|
||||
import magic.ui.helpers.ImageHelper;
|
||||
import magic.ui.utility.MagicStyle;
|
||||
|
||||
@SuppressWarnings("serial")
|
||||
public class MenuIconLabel extends JLabel {
|
||||
|
||||
private static final ImageIcon NORMAL_ICON = MagicImages.getIcon(MagicIcon.MENU);
|
||||
private static final Icon HILITE_ICON = ImageHelper.getRecoloredIcon(NORMAL_ICON, MagicStyle.getRolloverColor());
|
||||
private static final Icon PRESSED_ICON = ImageHelper.getRecoloredIcon(NORMAL_ICON, MagicStyle.getPressedColor());
|
||||
|
||||
private JPopupMenu menu;
|
||||
|
||||
public MenuIconLabel() {
|
||||
this.menu = null;
|
||||
setIcon(null);
|
||||
setMouseListener();
|
||||
}
|
||||
|
||||
public MenuIconLabel(final JPopupMenu aMenu) {
|
||||
this.menu = aMenu;
|
||||
setIcon(NORMAL_ICON);
|
||||
setMouseListener();
|
||||
}
|
||||
|
||||
private void setMouseListener() {
|
||||
addMouseListener(new MouseAdapter() {
|
||||
|
||||
private boolean isMenuVisible = false;
|
||||
|
||||
@Override
|
||||
public void mousePressed(MouseEvent e) {
|
||||
if (SwingUtilities.isLeftMouseButton(e)) {
|
||||
isMenuVisible = menu.isVisible();
|
||||
setIcon(PRESSED_ICON);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void mouseReleased(MouseEvent e) {
|
||||
if (SwingUtilities.isLeftMouseButton(e)) {
|
||||
setIcon(HILITE_ICON);
|
||||
if (isMenuVisible == false) {
|
||||
final Rectangle rect = getBounds();
|
||||
menu.show(MenuIconLabel.this.getParent(), rect.x, rect.y + rect.height + 2);
|
||||
isMenuVisible = true;
|
||||
} else {
|
||||
isMenuVisible = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void mouseEntered(MouseEvent e) {
|
||||
setIcon(HILITE_ICON);
|
||||
setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void mouseExited(MouseEvent e) {
|
||||
setIcon(NORMAL_ICON);
|
||||
setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR));
|
||||
}
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
void setPopupMenu(JPopupMenu aMenu) {
|
||||
this.menu = aMenu;
|
||||
setIcon(aMenu != null ? NORMAL_ICON : null);
|
||||
}
|
||||
}
|
|
@ -1,12 +1,13 @@
|
|||
package magic.ui.widget.duel.viewer;
|
||||
|
||||
import magic.ui.duel.viewerinfo.GameViewerInfo;
|
||||
import java.awt.Color;
|
||||
import java.awt.Dimension;
|
||||
import java.awt.event.ActionEvent;
|
||||
import java.awt.event.MouseAdapter;
|
||||
import java.awt.event.MouseEvent;
|
||||
import javax.swing.AbstractAction;
|
||||
import javax.swing.Icon;
|
||||
import javax.swing.ImageIcon;
|
||||
import javax.swing.JButton;
|
||||
import javax.swing.JLabel;
|
||||
import javax.swing.JMenuItem;
|
||||
|
@ -14,13 +15,14 @@ import javax.swing.JPanel;
|
|||
import javax.swing.JPopupMenu;
|
||||
import javax.swing.SwingUtilities;
|
||||
import magic.data.MagicIcon;
|
||||
import magic.ui.MagicImages;
|
||||
import magic.translate.StringContext;
|
||||
import magic.ui.utility.MagicStyle;
|
||||
import magic.ui.screen.duel.game.SwingGameController;
|
||||
import magic.translate.MText;
|
||||
import magic.translate.StringContext;
|
||||
import magic.ui.duel.viewerinfo.GameViewerInfo;
|
||||
import magic.ui.helpers.ImageHelper;
|
||||
import magic.ui.screen.duel.game.SwingGameController;
|
||||
import magic.ui.screen.widget.ActionBarButton;
|
||||
import magic.ui.theme.Theme;
|
||||
import magic.ui.utility.MagicStyle;
|
||||
import magic.utility.MagicSystem;
|
||||
import net.miginfocom.swing.MigLayout;
|
||||
|
||||
|
@ -35,6 +37,10 @@ public class TurnTitlePanel extends JPanel {
|
|||
private static final String _S4 = "Game %d / %d";
|
||||
private static final String _S5 = "Turn %d";
|
||||
|
||||
private static final Icon MENU_ICON = ImageHelper.getRecoloredIcon(
|
||||
MagicIcon.OPTION_MENU_TINY, Color.BLACK, Color.WHITE
|
||||
);
|
||||
|
||||
private final MigLayout miglayout = new MigLayout();
|
||||
private final JLabel scoreLabel = new JLabel();
|
||||
private final JLabel gameLabel = new JLabel();
|
||||
|
@ -67,7 +73,7 @@ public class TurnTitlePanel extends JPanel {
|
|||
private JButton getOptionsIconButton() {
|
||||
|
||||
final JButton btn = new ActionBarButton(
|
||||
MagicImages.getIcon(MagicIcon.MENU),
|
||||
(ImageIcon) MENU_ICON,
|
||||
MText.get(_S1),
|
||||
MText.get(_S2),
|
||||
new AbstractAction() {
|
||||
|
|
Loading…
Reference in New Issue