mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-19 04:08:01 +00:00
Remove unused FComboBox properties
This commit is contained in:
@@ -45,7 +45,6 @@ public class DecksComboBox extends FComboBox<DeckType> {
|
||||
private DeckType selectedDeckType = null;
|
||||
|
||||
public DecksComboBox() {
|
||||
setButtonVisible(true);
|
||||
FSkin.get(this).setFont(FSkin.getBoldFont(14));
|
||||
setTextAlignment(TextAlignment.CENTER);
|
||||
addActionListener(getDeckTypeComboListener());
|
||||
|
||||
@@ -43,7 +43,6 @@ public enum VSubmenuConstructed implements IVSubmenu<CSubmenuConstructed> {
|
||||
// CTR
|
||||
private VSubmenuConstructed() {
|
||||
FSkin.get(lblTitle).setBackground(FSkin.getColor(FSkin.Colors.CLR_THEME2));
|
||||
cboGamePlayers.setButtonVisible(true);
|
||||
cboGamePlayers.setTextAlignment(TextAlignment.CENTER);
|
||||
FSkin.get(cboGamePlayers).setFont(FSkin.getBoldFont(16));
|
||||
}
|
||||
|
||||
@@ -1,17 +1,9 @@
|
||||
package forge.gui.toolbox;
|
||||
|
||||
import java.awt.BorderLayout;
|
||||
import java.awt.Color;
|
||||
import java.awt.Component;
|
||||
import java.awt.Cursor;
|
||||
import java.awt.Dimension;
|
||||
import java.awt.Graphics;
|
||||
import java.awt.Graphics2D;
|
||||
import java.awt.LayoutManager;
|
||||
import java.awt.event.MouseAdapter;
|
||||
import java.awt.event.MouseEvent;
|
||||
|
||||
import javax.swing.BorderFactory;
|
||||
import javax.swing.ComboBoxModel;
|
||||
import javax.swing.DefaultListCellRenderer;
|
||||
import javax.swing.JButton;
|
||||
@@ -24,13 +16,9 @@ import javax.swing.SwingConstants;
|
||||
import javax.swing.UIManager;
|
||||
import javax.swing.border.Border;
|
||||
import javax.swing.border.EmptyBorder;
|
||||
import javax.swing.border.LineBorder;
|
||||
import javax.swing.plaf.basic.BasicComboBoxUI;
|
||||
import javax.swing.plaf.basic.ComboPopup;
|
||||
|
||||
import forge.gui.MouseUtil;
|
||||
import forge.gui.MouseUtil.MouseCursor;
|
||||
|
||||
@SuppressWarnings("serial")
|
||||
public class FComboBox<E> extends JComboBox<E> {
|
||||
|
||||
@@ -44,9 +32,6 @@ public class FComboBox<E> extends JComboBox<E> {
|
||||
}
|
||||
private TextAlignment textAlignment = TextAlignment.LEFT;
|
||||
|
||||
private boolean showComboButton = true;
|
||||
private MouseAdapter mouseListener = null;
|
||||
|
||||
// CTR
|
||||
public FComboBox() {
|
||||
super();
|
||||
@@ -64,65 +49,12 @@ public class FComboBox<E> extends JComboBox<E> {
|
||||
private void initialize() {
|
||||
setUI(new FComboBoxUI());
|
||||
setBorder(getDefaultBorder());
|
||||
setMouseListener();
|
||||
}
|
||||
|
||||
private Border getDefaultBorder() {
|
||||
return UIManager.getBorder("ComboBox.border");
|
||||
}
|
||||
|
||||
private Color getBorderColor() {
|
||||
Border thisBorder = getDefaultBorder();
|
||||
if (thisBorder != null && thisBorder instanceof LineBorder) {
|
||||
return ((LineBorder)thisBorder).getLineColor();
|
||||
} else {
|
||||
return getForeground();
|
||||
}
|
||||
}
|
||||
|
||||
public void setButtonVisible(boolean isVisible) {
|
||||
showComboButton = isVisible;
|
||||
initialize();
|
||||
}
|
||||
|
||||
private void setMouseListener() {
|
||||
if (mouseListener != null) {
|
||||
removeMouseListener(mouseListener);
|
||||
}
|
||||
if (!showComboButton) {
|
||||
mouseListener = new MouseAdapter() {
|
||||
@Override
|
||||
public void mouseEntered(MouseEvent e) {
|
||||
setMouseCursor(Cursor.HAND_CURSOR);
|
||||
setBorderHighlight(true);
|
||||
}
|
||||
@Override
|
||||
public void mouseExited(MouseEvent e) {
|
||||
setMouseCursor(Cursor.DEFAULT_CURSOR);
|
||||
setBorderHighlight(false);
|
||||
}
|
||||
};
|
||||
addMouseListener(mouseListener);
|
||||
}
|
||||
}
|
||||
|
||||
private void setBorderHighlight(boolean highlight) {
|
||||
if (isEnabled()) {
|
||||
if (highlight) {
|
||||
setBorder(BorderFactory.createLineBorder(getForeground(), 2));
|
||||
} else {
|
||||
setBorder(BorderFactory.createLineBorder(getBorderColor(), 1));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void setMouseCursor(int cursor) {
|
||||
// Testing...
|
||||
//SwingUtilities.getWindowAncestor(this).setCursor(Cursor.getPredefinedCursor(cursor));
|
||||
// Forge...
|
||||
MouseUtil.setMouseCursor(MouseCursor.fromInt(cursor));
|
||||
}
|
||||
|
||||
public void setTextAlignment(TextAlignment align) {
|
||||
textAlignment = align;
|
||||
}
|
||||
@@ -136,8 +68,8 @@ public class FComboBox<E> extends JComboBox<E> {
|
||||
int shapeHeight = 10;
|
||||
int x = getWidth() - shapeWidth - 8;
|
||||
int y = getHeight() / 2 - 2;
|
||||
int[] xPoints = {x, x + shapeWidth, x + (shapeWidth/2)};
|
||||
int[] yPoints = {y, y, y + (shapeHeight/2)};
|
||||
int[] xPoints = {x, x + shapeWidth, x + (shapeWidth / 2)};
|
||||
int[] yPoints = {y, y, y + (shapeHeight / 2)};
|
||||
g2d.fillPolygon(xPoints, yPoints, 3);
|
||||
}
|
||||
|
||||
@@ -145,12 +77,8 @@ public class FComboBox<E> extends JComboBox<E> {
|
||||
|
||||
@Override
|
||||
protected LayoutManager createLayoutManager() {
|
||||
if (!showComboButton) {
|
||||
return new BorderLayout();
|
||||
} else {
|
||||
return super.createLayoutManager();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected ComboPopup createPopup() {
|
||||
|
||||
@@ -23,7 +23,7 @@ import forge.properties.ForgePreferences.FPref;
|
||||
@SuppressWarnings("serial")
|
||||
public class FComboBoxPanel<E> extends JPanel {
|
||||
|
||||
private static ArrayList<FComboBoxPanel<?>> allPanels = new ArrayList<FComboBoxPanel<?>>();
|
||||
private static final ArrayList<FComboBoxPanel<?>> allPanels = new ArrayList<FComboBoxPanel<?>>();
|
||||
|
||||
public static void refreshAllSkins() {
|
||||
for (FComboBoxPanel<?> panel : allPanels) {
|
||||
|
||||
@@ -17,7 +17,7 @@ import javax.swing.ListCellRenderer;
|
||||
*/
|
||||
public class FComboBoxWrapper<E> {
|
||||
|
||||
private static ArrayList<FComboBoxWrapper<?>> allWrappers = new ArrayList<FComboBoxWrapper<?>>();
|
||||
private static final ArrayList<FComboBoxWrapper<?>> allWrappers = new ArrayList<FComboBoxWrapper<?>>();
|
||||
|
||||
public static void refreshAllSkins() {
|
||||
for (FComboBoxWrapper<?> wrapper : allWrappers) {
|
||||
|
||||
Reference in New Issue
Block a user