forked from External/mage
Remembering toggle state for BigCard component between games
This commit is contained in:
parent
435798f7d5
commit
29e57830b4
2 changed files with 46 additions and 1 deletions
|
|
@ -57,6 +57,8 @@ import org.apache.log4j.Logger;
|
|||
import javax.swing.*;
|
||||
import javax.swing.GroupLayout.Alignment;
|
||||
import javax.swing.border.LineBorder;
|
||||
import javax.swing.plaf.basic.BasicSplitPaneDivider;
|
||||
import javax.swing.plaf.basic.BasicSplitPaneUI;
|
||||
import java.awt.*;
|
||||
import java.awt.event.*;
|
||||
import java.io.Serializable;
|
||||
|
|
@ -87,6 +89,7 @@ public class GamePanel extends javax.swing.JPanel {
|
|||
private JLayeredPane jLayeredPane;
|
||||
private String chosenHandKey = "You";
|
||||
private boolean smallMode = false;
|
||||
private boolean initialized = false;
|
||||
|
||||
private HelperPanel helper;
|
||||
|
||||
|
|
@ -123,6 +126,17 @@ public class GamePanel extends javax.swing.JPanel {
|
|||
j.setSize(width, height);
|
||||
jSplitPane0.setSize(width, height);
|
||||
sizeToScreen();
|
||||
|
||||
if (!initialized) {
|
||||
String state = PreferencesDialog.getCachedValue(PreferencesDialog.KEY_BIG_CARD_TOGGLED, null);
|
||||
if (state != null) {
|
||||
if (state.equals("down")) {
|
||||
jSplitPane0.setDividerLocation(1.0);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
initialized = true;
|
||||
}
|
||||
});
|
||||
|
||||
|
|
@ -791,6 +805,24 @@ public class GamePanel extends javax.swing.JPanel {
|
|||
}
|
||||
});
|
||||
|
||||
final BasicSplitPaneUI ui = (BasicSplitPaneUI) jSplitPane0.getUI();
|
||||
final BasicSplitPaneDivider divider = ui.getDivider();
|
||||
final JButton upArrowButton = (JButton) divider.getComponent(0);
|
||||
upArrowButton.addActionListener(new ActionListener() {
|
||||
@Override
|
||||
public void actionPerformed(ActionEvent actionEvent) {
|
||||
PreferencesDialog.saveValue(PreferencesDialog.KEY_BIG_CARD_TOGGLED, "up");
|
||||
}
|
||||
});
|
||||
|
||||
final JButton downArrowButton = (JButton) divider.getComponent(1);
|
||||
downArrowButton.addActionListener(new ActionListener() {
|
||||
@Override
|
||||
public void actionPerformed(ActionEvent actionEvent) {
|
||||
PreferencesDialog.saveValue(PreferencesDialog.KEY_BIG_CARD_TOGGLED, "down");
|
||||
}
|
||||
});
|
||||
|
||||
KeyStroke ksAltShiftReleased = KeyStroke.getKeyStroke(KeyEvent.VK_E, InputEvent.ALT_MASK, true);
|
||||
this.getInputMap(c).put(ksAltShiftReleased, "ENLARGE_RELEASE");
|
||||
this.getActionMap().put("ENLARGE_RELEASE", new AbstractAction() {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue