mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-19 20:28:00 +00:00
Checkstyle fixes in a couple GUI files
This commit is contained in:
@@ -102,7 +102,7 @@ import forge.view.swing.OldGuiNewGame;
|
|||||||
* @version $Id$
|
* @version $Id$
|
||||||
*/
|
*/
|
||||||
public class GuiDisplay4 extends JFrame implements CardContainer, Display, NewConstants, NewConstants.GUI.GuiDisplay, NewConstants.LANG.GuiDisplay {
|
public class GuiDisplay4 extends JFrame implements CardContainer, Display, NewConstants, NewConstants.GUI.GuiDisplay, NewConstants.LANG.GuiDisplay {
|
||||||
/** Constant <code>serialVersionUID=4519302185194841060L</code> */
|
/** Constant <code>serialVersionUID=4519302185194841060L</code>. */
|
||||||
private static final long serialVersionUID = 4519302185194841060L;
|
private static final long serialVersionUID = 4519302185194841060L;
|
||||||
|
|
||||||
private GuiInput inputControl;
|
private GuiInput inputControl;
|
||||||
@@ -111,7 +111,7 @@ public class GuiDisplay4 extends JFrame implements CardContainer, Display, NewCo
|
|||||||
Font lifeFont = new Font("Dialog", Font.PLAIN, 40);
|
Font lifeFont = new Font("Dialog", Font.PLAIN, 40);
|
||||||
// Font checkboxFont = new Font("Dialog", Font.PLAIN, 9);
|
// Font checkboxFont = new Font("Dialog", Font.PLAIN, 9);
|
||||||
|
|
||||||
/** Constant <code>greenColor</code> */
|
/** Constant <code>greenColor</code>. */
|
||||||
public static Color greenColor = new Color(0, 164, 0);
|
public static Color greenColor = new Color(0, 164, 0);
|
||||||
|
|
||||||
private Action HUMAN_GRAVEYARD_ACTION;
|
private Action HUMAN_GRAVEYARD_ACTION;
|
||||||
@@ -141,7 +141,7 @@ public class GuiDisplay4 extends JFrame implements CardContainer, Display, NewCo
|
|||||||
|
|
||||||
/** {@inheritDoc} */
|
/** {@inheritDoc} */
|
||||||
@Override
|
@Override
|
||||||
public void setVisible(boolean visible) {
|
public final void setVisible(final boolean visible) {
|
||||||
if (visible) {
|
if (visible) {
|
||||||
//causes an error if put in the constructor, causes some random null pointer exception
|
//causes an error if put in the constructor, causes some random null pointer exception
|
||||||
AllZone.getInputControl().updateObservers();
|
AllZone.getInputControl().updateObservers();
|
||||||
@@ -154,9 +154,10 @@ public class GuiDisplay4 extends JFrame implements CardContainer, Display, NewCo
|
|||||||
}
|
}
|
||||||
|
|
||||||
/** {@inheritDoc} */
|
/** {@inheritDoc} */
|
||||||
public void assignDamage(Card attacker, CardList blockers, int damage) {
|
public final void assignDamage(final Card attacker, final CardList blockers, final int damage) {
|
||||||
if (damage <= 0)
|
if (damage <= 0) {
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
new Gui_MultipleBlockers4(attacker, blockers, damage, this);
|
new Gui_MultipleBlockers4(attacker, blockers, damage, this);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -172,11 +173,12 @@ public class GuiDisplay4 extends JFrame implements CardContainer, Display, NewCo
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected Iterable<Card> getCardsAsIterable() {
|
protected Iterable<Card> getCardsAsIterable() {
|
||||||
return new ImmutableIterableFrom<Card>(CardFactoryUtil.getExternalZoneActivationCards(AllZone.getHumanPlayer()));
|
return new ImmutableIterableFrom<Card>(
|
||||||
|
CardFactoryUtil.getExternalZoneActivationCards(AllZone.getHumanPlayer()));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void doAction(Card c) {
|
protected void doAction(final Card c) {
|
||||||
AllZone.getGameAction().playCard(c);
|
AllZone.getGameAction().playCard(c);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@@ -193,17 +195,30 @@ public class GuiDisplay4 extends JFrame implements CardContainer, Display, NewCo
|
|||||||
private void addMenu() {
|
private void addMenu() {
|
||||||
// Game Menu Creation
|
// Game Menu Creation
|
||||||
Object[] obj = {
|
Object[] obj = {
|
||||||
HUMAN_DECKLIST_ACTION, HUMAN_GRAVEYARD_ACTION, HUMAN_REMOVED_ACTION, HUMAN_FLASHBACK_ACTION, COMPUTER_GRAVEYARD_ACTION,
|
HUMAN_DECKLIST_ACTION,
|
||||||
COMPUTER_REMOVED_ACTION, new JSeparator(),
|
HUMAN_GRAVEYARD_ACTION,
|
||||||
playsoundCheckboxForMenu, new JSeparator(), ErrorViewer.ALL_THREADS_ACTION,
|
HUMAN_REMOVED_ACTION,
|
||||||
CONCEDE_ACTION};
|
HUMAN_FLASHBACK_ACTION,
|
||||||
|
COMPUTER_GRAVEYARD_ACTION,
|
||||||
|
COMPUTER_REMOVED_ACTION,
|
||||||
|
new JSeparator(),
|
||||||
|
playsoundCheckboxForMenu,
|
||||||
|
new JSeparator(),
|
||||||
|
ErrorViewer.ALL_THREADS_ACTION,
|
||||||
|
CONCEDE_ACTION
|
||||||
|
};
|
||||||
|
|
||||||
JMenu gameMenu = new JMenu(ForgeProps.getLocalized(MENU_BAR.MENU.TITLE));
|
JMenu gameMenu = new JMenu(ForgeProps.getLocalized(MENU_BAR.MENU.TITLE));
|
||||||
for (Object o : obj) {
|
for (Object o : obj) {
|
||||||
if (o instanceof ForgeAction) gameMenu.add(((ForgeAction) o).setupButton(new JMenuItem()));
|
if (o instanceof ForgeAction) {
|
||||||
else if (o instanceof Action) gameMenu.add((Action) o);
|
gameMenu.add(((ForgeAction) o).setupButton(new JMenuItem()));
|
||||||
else if (o instanceof Component) gameMenu.add((Component) o);
|
} else if (o instanceof Action) {
|
||||||
else throw new AssertionError();
|
gameMenu.add((Action) o);
|
||||||
|
} else if (o instanceof Component) {
|
||||||
|
gameMenu.add((Component) o);
|
||||||
|
} else {
|
||||||
|
throw new AssertionError();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Phase Menu Creation
|
// Phase Menu Creation
|
||||||
@@ -235,7 +250,7 @@ public class GuiDisplay4 extends JFrame implements CardContainer, Display, NewCo
|
|||||||
ForgeAction generateMana = new ForgeAction(MANAGEN) {
|
ForgeAction generateMana = new ForgeAction(MANAGEN) {
|
||||||
private static final long serialVersionUID = 7171104690016706405L;
|
private static final long serialVersionUID = 7171104690016706405L;
|
||||||
|
|
||||||
public void actionPerformed(ActionEvent arg0) {
|
public void actionPerformed(final ActionEvent arg0) {
|
||||||
GuiDisplayUtil.devModeGenerateMana();
|
GuiDisplayUtil.devModeGenerateMana();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@@ -244,7 +259,7 @@ public class GuiDisplay4 extends JFrame implements CardContainer, Display, NewCo
|
|||||||
ForgeAction setupBattleField = new ForgeAction(SETUPBATTLEFIELD) {
|
ForgeAction setupBattleField = new ForgeAction(SETUPBATTLEFIELD) {
|
||||||
private static final long serialVersionUID = -6660930759092583160L;
|
private static final long serialVersionUID = -6660930759092583160L;
|
||||||
|
|
||||||
public void actionPerformed(ActionEvent arg0) {
|
public void actionPerformed(final ActionEvent arg0) {
|
||||||
GuiDisplayUtil.devSetupGameState();
|
GuiDisplayUtil.devSetupGameState();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@@ -254,7 +269,7 @@ public class GuiDisplay4 extends JFrame implements CardContainer, Display, NewCo
|
|||||||
ForgeAction tutor = new ForgeAction(TUTOR) {
|
ForgeAction tutor = new ForgeAction(TUTOR) {
|
||||||
private static final long serialVersionUID = 2003222642609217705L;
|
private static final long serialVersionUID = 2003222642609217705L;
|
||||||
|
|
||||||
public void actionPerformed(ActionEvent arg0) {
|
public void actionPerformed(final ActionEvent arg0) {
|
||||||
GuiDisplayUtil.devModeTutor();
|
GuiDisplayUtil.devModeTutor();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@@ -264,7 +279,7 @@ public class GuiDisplay4 extends JFrame implements CardContainer, Display, NewCo
|
|||||||
ForgeAction addCounter = new ForgeAction(ADDCOUNTER) {
|
ForgeAction addCounter = new ForgeAction(ADDCOUNTER) {
|
||||||
private static final long serialVersionUID = 3136264111882855268L;
|
private static final long serialVersionUID = 3136264111882855268L;
|
||||||
|
|
||||||
public void actionPerformed(ActionEvent arg0) {
|
public void actionPerformed(final ActionEvent arg0) {
|
||||||
GuiDisplayUtil.devModeAddCounter();
|
GuiDisplayUtil.devModeAddCounter();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@@ -274,7 +289,7 @@ public class GuiDisplay4 extends JFrame implements CardContainer, Display, NewCo
|
|||||||
ForgeAction tapPerm = new ForgeAction(TAPPERM) {
|
ForgeAction tapPerm = new ForgeAction(TAPPERM) {
|
||||||
private static final long serialVersionUID = -6092045653540313527L;
|
private static final long serialVersionUID = -6092045653540313527L;
|
||||||
|
|
||||||
public void actionPerformed(ActionEvent arg0) {
|
public void actionPerformed(final ActionEvent arg0) {
|
||||||
GuiDisplayUtil.devModeTapPerm();
|
GuiDisplayUtil.devModeTapPerm();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@@ -284,7 +299,7 @@ public class GuiDisplay4 extends JFrame implements CardContainer, Display, NewCo
|
|||||||
ForgeAction untapPerm = new ForgeAction(UNTAPPERM) {
|
ForgeAction untapPerm = new ForgeAction(UNTAPPERM) {
|
||||||
private static final long serialVersionUID = 5425291996157256656L;
|
private static final long serialVersionUID = 5425291996157256656L;
|
||||||
|
|
||||||
public void actionPerformed(ActionEvent arg0) {
|
public void actionPerformed(final ActionEvent arg0) {
|
||||||
GuiDisplayUtil.devModeUntapPerm();
|
GuiDisplayUtil.devModeUntapPerm();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@@ -294,7 +309,7 @@ public class GuiDisplay4 extends JFrame implements CardContainer, Display, NewCo
|
|||||||
ForgeAction unlimitedLand = new ForgeAction(NOLANDLIMIT) {
|
ForgeAction unlimitedLand = new ForgeAction(NOLANDLIMIT) {
|
||||||
private static final long serialVersionUID = 2184353891062202796L;
|
private static final long serialVersionUID = 2184353891062202796L;
|
||||||
|
|
||||||
public void actionPerformed(ActionEvent arg0) {
|
public void actionPerformed(final ActionEvent arg0) {
|
||||||
GuiDisplayUtil.devModeUnlimitedLand();
|
GuiDisplayUtil.devModeUnlimitedLand();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@@ -304,7 +319,7 @@ public class GuiDisplay4 extends JFrame implements CardContainer, Display, NewCo
|
|||||||
ForgeAction setLife = new ForgeAction(SETLIFE) {
|
ForgeAction setLife = new ForgeAction(SETLIFE) {
|
||||||
private static final long serialVersionUID = -1750588303928974918L;
|
private static final long serialVersionUID = -1750588303928974918L;
|
||||||
|
|
||||||
public void actionPerformed(ActionEvent arg0) {
|
public void actionPerformed(final ActionEvent arg0) {
|
||||||
GuiDisplayUtil.devModeSetLife();
|
GuiDisplayUtil.devModeSetLife();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@@ -325,14 +340,15 @@ public class GuiDisplay4 extends JFrame implements CardContainer, Display, NewCo
|
|||||||
setLife
|
setLife
|
||||||
};
|
};
|
||||||
for (Object o : objDev) {
|
for (Object o : objDev) {
|
||||||
if (o instanceof ForgeAction)
|
if (o instanceof ForgeAction) {
|
||||||
devMenu.add(((ForgeAction) o).setupButton(new JMenuItem()));
|
devMenu.add(((ForgeAction) o).setupButton(new JMenuItem()));
|
||||||
else if (o instanceof Component)
|
} else if (o instanceof Component) {
|
||||||
devMenu.add((Component) o);
|
devMenu.add((Component) o);
|
||||||
else if (o instanceof Action)
|
} else if (o instanceof Action) {
|
||||||
devMenu.add((Action) o);
|
devMenu.add((Action) o);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
JMenuBar menuBar = new JMenuBar();
|
JMenuBar menuBar = new JMenuBar();
|
||||||
menuBar.add(gameMenu);
|
menuBar.add(gameMenu);
|
||||||
@@ -347,7 +363,7 @@ public class GuiDisplay4 extends JFrame implements CardContainer, Display, NewCo
|
|||||||
*
|
*
|
||||||
* @return a boolean.
|
* @return a boolean.
|
||||||
*/
|
*/
|
||||||
public boolean canLoseByDecking() {
|
public final boolean canLoseByDecking() {
|
||||||
return canLoseByDecking.isSelected();
|
return canLoseByDecking.isSelected();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -356,7 +372,7 @@ public class GuiDisplay4 extends JFrame implements CardContainer, Display, NewCo
|
|||||||
*
|
*
|
||||||
* @return a {@link forge.MyButton} object.
|
* @return a {@link forge.MyButton} object.
|
||||||
*/
|
*/
|
||||||
public MyButton getButtonOK() {
|
public final MyButton getButtonOK() {
|
||||||
MyButton ok = new MyButton() {
|
MyButton ok = new MyButton() {
|
||||||
public void select() {
|
public void select() {
|
||||||
inputControl.selectButtonOK();
|
inputControl.selectButtonOK();
|
||||||
@@ -366,7 +382,7 @@ public class GuiDisplay4 extends JFrame implements CardContainer, Display, NewCo
|
|||||||
return okButton.isEnabled();
|
return okButton.isEnabled();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setSelectable(boolean b) {
|
public void setSelectable(final boolean b) {
|
||||||
okButton.setEnabled(b);
|
okButton.setEnabled(b);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -374,7 +390,7 @@ public class GuiDisplay4 extends JFrame implements CardContainer, Display, NewCo
|
|||||||
return okButton.getText();
|
return okButton.getText();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setText(String text) {
|
public void setText(final String text) {
|
||||||
okButton.setText(text);
|
okButton.setText(text);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -391,7 +407,7 @@ public class GuiDisplay4 extends JFrame implements CardContainer, Display, NewCo
|
|||||||
*
|
*
|
||||||
* @return a {@link forge.MyButton} object.
|
* @return a {@link forge.MyButton} object.
|
||||||
*/
|
*/
|
||||||
public MyButton getButtonCancel() {
|
public final MyButton getButtonCancel() {
|
||||||
MyButton cancel = new MyButton() {
|
MyButton cancel = new MyButton() {
|
||||||
public void select() {
|
public void select() {
|
||||||
inputControl.selectButtonCancel();
|
inputControl.selectButtonCancel();
|
||||||
@@ -401,7 +417,7 @@ public class GuiDisplay4 extends JFrame implements CardContainer, Display, NewCo
|
|||||||
return cancelButton.isEnabled();
|
return cancelButton.isEnabled();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setSelectable(boolean b) {
|
public void setSelectable(final boolean b) {
|
||||||
cancelButton.setEnabled(b);
|
cancelButton.setEnabled(b);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -409,7 +425,7 @@ public class GuiDisplay4 extends JFrame implements CardContainer, Display, NewCo
|
|||||||
return cancelButton.getText();
|
return cancelButton.getText();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setText(String text) {
|
public void setText(final String text) {
|
||||||
cancelButton.setText(text);
|
cancelButton.setText(text);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -421,31 +437,32 @@ public class GuiDisplay4 extends JFrame implements CardContainer, Display, NewCo
|
|||||||
} //getButtonCancel()
|
} //getButtonCancel()
|
||||||
|
|
||||||
/** {@inheritDoc} */
|
/** {@inheritDoc} */
|
||||||
public void showCombat(String message) {
|
public final void showCombat(final String message) {
|
||||||
combatArea.setText(message);
|
combatArea.setText(message);
|
||||||
}
|
}
|
||||||
|
|
||||||
/** {@inheritDoc} */
|
/** {@inheritDoc} */
|
||||||
public void showMessage(String s) {
|
public final void showMessage(final String s) {
|
||||||
messageArea.setText(s);
|
messageArea.setText(s);
|
||||||
|
|
||||||
Border border = null;
|
Border border = null;
|
||||||
int thickness = 3;
|
int thickness = 3;
|
||||||
|
|
||||||
if (AllZone.getStack().size() > 0 && AllZone.getStack().peekInstance().getActivatingPlayer().isComputer())
|
if (AllZone.getStack().size() > 0 && AllZone.getStack().peekInstance().getActivatingPlayer().isComputer()) {
|
||||||
border = BorderFactory.createLineBorder(new Color(0, 255, 255), thickness);
|
border = BorderFactory.createLineBorder(new Color(0, 255, 255), thickness);
|
||||||
else if (s.contains("Main"))
|
} else if (s.contains("Main")) {
|
||||||
border = BorderFactory.createLineBorder(new Color(30, 0, 255), thickness);
|
border = BorderFactory.createLineBorder(new Color(30, 0, 255), thickness);
|
||||||
else if (s.contains("To Block"))
|
} else if (s.contains("To Block")) {
|
||||||
border = BorderFactory.createLineBorder(new Color(13, 179, 0), thickness);
|
border = BorderFactory.createLineBorder(new Color(13, 179, 0), thickness);
|
||||||
else if (s.contains("Play Instants and Abilities") || s.contains("Combat") || s.contains("Damage"))
|
} else if (s.contains("Play Instants and Abilities") || s.contains("Combat") || s.contains("Damage")) {
|
||||||
border = BorderFactory.createLineBorder(new Color(255, 174, 0), thickness);
|
border = BorderFactory.createLineBorder(new Color(255, 174, 0), thickness);
|
||||||
else if (s.contains("Declare Attackers"))
|
} else if (s.contains("Declare Attackers")) {
|
||||||
border = BorderFactory.createLineBorder(new Color(255, 0, 0), thickness);
|
border = BorderFactory.createLineBorder(new Color(255, 0, 0), thickness);
|
||||||
else if (s.contains("Upkeep") || s.contains("Draw") || s.contains("End of Turn"))
|
} else if (s.contains("Upkeep") || s.contains("Draw") || s.contains("End of Turn")) {
|
||||||
border = BorderFactory.createLineBorder(new Color(200, 0, 170), thickness);
|
border = BorderFactory.createLineBorder(new Color(200, 0, 170), thickness);
|
||||||
else
|
} else {
|
||||||
border = new EmptyBorder(1, 1, 1, 1);
|
border = new EmptyBorder(1, 1, 1, 1);
|
||||||
|
}
|
||||||
|
|
||||||
messageArea.setBorder(border);
|
messageArea.setBorder(border);
|
||||||
}
|
}
|
||||||
@@ -457,7 +474,7 @@ public class GuiDisplay4 extends JFrame implements CardContainer, Display, NewCo
|
|||||||
//mouse Card Detail
|
//mouse Card Detail
|
||||||
playerHandPanel.addMouseMotionListener(new MouseMotionAdapter() {
|
playerHandPanel.addMouseMotionListener(new MouseMotionAdapter() {
|
||||||
@Override
|
@Override
|
||||||
public void mouseMoved(MouseEvent me) {
|
public void mouseMoved(final MouseEvent me) {
|
||||||
Card c = playerHandPanel.getCardFromMouseOverPanel();
|
Card c = playerHandPanel.getCardFromMouseOverPanel();
|
||||||
if (c != null) {
|
if (c != null) {
|
||||||
setCard(c);
|
setCard(c);
|
||||||
@@ -467,7 +484,7 @@ public class GuiDisplay4 extends JFrame implements CardContainer, Display, NewCo
|
|||||||
|
|
||||||
playerPlayPanel.addMouseMotionListener(new MouseMotionAdapter() {
|
playerPlayPanel.addMouseMotionListener(new MouseMotionAdapter() {
|
||||||
@Override
|
@Override
|
||||||
public void mouseMoved(MouseEvent me) {
|
public void mouseMoved(final MouseEvent me) {
|
||||||
Card c = playerPlayPanel.getCardFromMouseOverPanel();
|
Card c = playerPlayPanel.getCardFromMouseOverPanel();
|
||||||
if (c != null) {
|
if (c != null) {
|
||||||
setCard(c);
|
setCard(c);
|
||||||
@@ -477,7 +494,7 @@ public class GuiDisplay4 extends JFrame implements CardContainer, Display, NewCo
|
|||||||
|
|
||||||
oppPlayPanel.addMouseMotionListener(new MouseMotionAdapter() {
|
oppPlayPanel.addMouseMotionListener(new MouseMotionAdapter() {
|
||||||
@Override
|
@Override
|
||||||
public void mouseMoved(MouseEvent me) {
|
public void mouseMoved(final MouseEvent me) {
|
||||||
Card c = oppPlayPanel.getCardFromMouseOverPanel();
|
Card c = oppPlayPanel.getCardFromMouseOverPanel();
|
||||||
if (c != null) {
|
if (c != null) {
|
||||||
setCard(c);
|
setCard(c);
|
||||||
@@ -490,14 +507,14 @@ public class GuiDisplay4 extends JFrame implements CardContainer, Display, NewCo
|
|||||||
oppLifeLabel.addMouseListener(new MouseAdapter() {
|
oppLifeLabel.addMouseListener(new MouseAdapter() {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void mousePressed(MouseEvent e) {
|
public void mousePressed(final MouseEvent e) {
|
||||||
inputControl.selectPlayer(AllZone.getComputerPlayer());
|
inputControl.selectPlayer(AllZone.getComputerPlayer());
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
oppLifeLabel.addMouseMotionListener(new MouseMotionAdapter() {
|
oppLifeLabel.addMouseMotionListener(new MouseMotionAdapter() {
|
||||||
@Override
|
@Override
|
||||||
public void mouseMoved(MouseEvent me) {
|
public void mouseMoved(final MouseEvent me) {
|
||||||
setCard(AllZone.getComputerManaPool());
|
setCard(AllZone.getComputerManaPool());
|
||||||
} //mouseMoved
|
} //mouseMoved
|
||||||
});
|
});
|
||||||
@@ -506,7 +523,7 @@ public class GuiDisplay4 extends JFrame implements CardContainer, Display, NewCo
|
|||||||
playerLifeLabel.addMouseListener(new MouseAdapter() {
|
playerLifeLabel.addMouseListener(new MouseAdapter() {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void mousePressed(MouseEvent e) {
|
public void mousePressed(final MouseEvent e) {
|
||||||
inputControl.selectPlayer(AllZone.getHumanPlayer());
|
inputControl.selectPlayer(AllZone.getHumanPlayer());
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@@ -515,7 +532,7 @@ public class GuiDisplay4 extends JFrame implements CardContainer, Display, NewCo
|
|||||||
playerPlayPanel.addMouseListener(new MouseAdapter() {
|
playerPlayPanel.addMouseListener(new MouseAdapter() {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void mousePressed(MouseEvent e) {
|
public void mousePressed(final MouseEvent e) {
|
||||||
Card c = playerPlayPanel.getCardFromMouseOverPanel();
|
Card c = playerPlayPanel.getCardFromMouseOverPanel();
|
||||||
if (c != null) {
|
if (c != null) {
|
||||||
|
|
||||||
@@ -546,11 +563,14 @@ public class GuiDisplay4 extends JFrame implements CardContainer, Display, NewCo
|
|||||||
c.untap();
|
c.untap();
|
||||||
AllZone.getCombat().removeFromCombat(c);
|
AllZone.getCombat().removeFromCombat(c);
|
||||||
} else if (inputControl.input instanceof Input_Block) {
|
} else if (inputControl.input instanceof Input_Block) {
|
||||||
if (c.getController().isHuman())
|
if (c.getController().isHuman()) {
|
||||||
AllZone.getCombat().removeFromCombat(c);
|
AllZone.getCombat().removeFromCombat(c);
|
||||||
|
}
|
||||||
((Input_Block) inputControl.input).removeFromAllBlocking(c);
|
((Input_Block) inputControl.input).removeFromAllBlocking(c);
|
||||||
}
|
}
|
||||||
} else inputControl.selectCard(c, AllZone.getHumanBattlefield());
|
} else {
|
||||||
|
inputControl.selectCard(c, AllZone.getHumanBattlefield());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@@ -559,8 +579,10 @@ public class GuiDisplay4 extends JFrame implements CardContainer, Display, NewCo
|
|||||||
playerHandPanel.addMouseListener(new MouseAdapter() {
|
playerHandPanel.addMouseListener(new MouseAdapter() {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void mousePressed(MouseEvent e) {
|
public void mousePressed(final MouseEvent e) {
|
||||||
if (e.getButton() != MouseEvent.BUTTON1) return;
|
if (e.getButton() != MouseEvent.BUTTON1) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
Card c = playerHandPanel.getCardFromMouseOverPanel();
|
Card c = playerHandPanel.getCardFromMouseOverPanel();
|
||||||
if (c != null) {
|
if (c != null) {
|
||||||
inputControl.selectCard(c, AllZone.getHumanHand());
|
inputControl.selectCard(c, AllZone.getHumanHand());
|
||||||
@@ -576,7 +598,7 @@ public class GuiDisplay4 extends JFrame implements CardContainer, Display, NewCo
|
|||||||
oppPlayPanel.addMouseListener(new MouseAdapter() {
|
oppPlayPanel.addMouseListener(new MouseAdapter() {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void mousePressed(MouseEvent e) {
|
public void mousePressed(final MouseEvent e) {
|
||||||
Card c = oppPlayPanel.getCardFromMouseOverPanel();
|
Card c = oppPlayPanel.getCardFromMouseOverPanel();
|
||||||
if (c != null) {
|
if (c != null) {
|
||||||
inputControl.selectCard(c, AllZone.getComputerBattlefield());
|
inputControl.selectCard(c, AllZone.getComputerBattlefield());
|
||||||
@@ -592,12 +614,12 @@ public class GuiDisplay4 extends JFrame implements CardContainer, Display, NewCo
|
|||||||
*
|
*
|
||||||
* @return a {@link forge.Card} object.
|
* @return a {@link forge.Card} object.
|
||||||
*/
|
*/
|
||||||
public Card getCard() {
|
public final Card getCard() {
|
||||||
return detail.getCard();
|
return detail.getCard();
|
||||||
}
|
}
|
||||||
|
|
||||||
/** {@inheritDoc} */
|
/** {@inheritDoc} */
|
||||||
public void setCard(Card card) {
|
public final void setCard(final Card card) {
|
||||||
detail.setCard(card);
|
detail.setCard(card);
|
||||||
picture.setCard(card);
|
picture.setCard(card);
|
||||||
}
|
}
|
||||||
@@ -609,7 +631,7 @@ public class GuiDisplay4 extends JFrame implements CardContainer, Display, NewCo
|
|||||||
//Human Hand, Graveyard, and Library totals
|
//Human Hand, Graveyard, and Library totals
|
||||||
{ //make sure to not interfer with anything below, since this is a very long method
|
{ //make sure to not interfer with anything below, since this is a very long method
|
||||||
Observer o = new Observer() {
|
Observer o = new Observer() {
|
||||||
public void update(Observable a, Object b) {
|
public void update(final Observable a, final Object b) {
|
||||||
playerHandValue.setText("" + AllZone.getHumanHand().size());
|
playerHandValue.setText("" + AllZone.getHumanHand().size());
|
||||||
playerGraveValue.setText("" + AllZone.getHumanGraveyard().size());
|
playerGraveValue.setText("" + AllZone.getHumanGraveyard().size());
|
||||||
playerLibraryValue.setText("" + AllZone.getHumanLibrary().size());
|
playerLibraryValue.setText("" + AllZone.getHumanLibrary().size());
|
||||||
@@ -626,7 +648,7 @@ public class GuiDisplay4 extends JFrame implements CardContainer, Display, NewCo
|
|||||||
//opponent Hand, Graveyard, and Library totals
|
//opponent Hand, Graveyard, and Library totals
|
||||||
{ //make sure to not interfer with anything below, since this is a very long method
|
{ //make sure to not interfer with anything below, since this is a very long method
|
||||||
Observer o = new Observer() {
|
Observer o = new Observer() {
|
||||||
public void update(Observable a, Object b) {
|
public void update(final Observable a, final Object b) {
|
||||||
oppHandValue.setText("" + AllZone.getComputerHand().size());
|
oppHandValue.setText("" + AllZone.getComputerHand().size());
|
||||||
oppGraveValue.setText("" + AllZone.getComputerGraveyard().size());
|
oppGraveValue.setText("" + AllZone.getComputerGraveyard().size());
|
||||||
oppLibraryValue.setText("" + AllZone.getComputerLibrary().size());
|
oppLibraryValue.setText("" + AllZone.getComputerLibrary().size());
|
||||||
@@ -642,7 +664,7 @@ public class GuiDisplay4 extends JFrame implements CardContainer, Display, NewCo
|
|||||||
//opponent life
|
//opponent life
|
||||||
oppLifeLabel.setText("" + AllZone.getComputerPlayer().getLife());
|
oppLifeLabel.setText("" + AllZone.getComputerPlayer().getLife());
|
||||||
AllZone.getComputerPlayer().addObserver(new Observer() {
|
AllZone.getComputerPlayer().addObserver(new Observer() {
|
||||||
public void update(Observable a, Object b) {
|
public void update(final Observable a, final Object b) {
|
||||||
int life = AllZone.getComputerPlayer().getLife();
|
int life = AllZone.getComputerPlayer().getLife();
|
||||||
oppLifeLabel.setText("" + life);
|
oppLifeLabel.setText("" + life);
|
||||||
}
|
}
|
||||||
@@ -664,7 +686,7 @@ public class GuiDisplay4 extends JFrame implements CardContainer, Display, NewCo
|
|||||||
|
|
||||||
oppPCLabel.setText("Poison Counters: " + AllZone.getComputerPlayer().getPoisonCounters());
|
oppPCLabel.setText("Poison Counters: " + AllZone.getComputerPlayer().getPoisonCounters());
|
||||||
AllZone.getComputerPlayer().addObserver(new Observer() {
|
AllZone.getComputerPlayer().addObserver(new Observer() {
|
||||||
public void update(Observable a, Object b) {
|
public void update(final Observable a, final Object b) {
|
||||||
int pcs = AllZone.getComputerPlayer().getPoisonCounters();
|
int pcs = AllZone.getComputerPlayer().getPoisonCounters();
|
||||||
oppPCLabel.setText("Poison Counters: " + pcs);
|
oppPCLabel.setText("Poison Counters: " + pcs);
|
||||||
}
|
}
|
||||||
@@ -674,7 +696,7 @@ public class GuiDisplay4 extends JFrame implements CardContainer, Display, NewCo
|
|||||||
//player life
|
//player life
|
||||||
playerLifeLabel.setText("" + AllZone.getHumanPlayer().getLife());
|
playerLifeLabel.setText("" + AllZone.getHumanPlayer().getLife());
|
||||||
AllZone.getHumanPlayer().addObserver(new Observer() {
|
AllZone.getHumanPlayer().addObserver(new Observer() {
|
||||||
public void update(Observable a, Object b) {
|
public void update(final Observable a, final Object b) {
|
||||||
int life = AllZone.getHumanPlayer().getLife();
|
int life = AllZone.getHumanPlayer().getLife();
|
||||||
playerLifeLabel.setText("" + life);
|
playerLifeLabel.setText("" + life);
|
||||||
}
|
}
|
||||||
@@ -683,7 +705,7 @@ public class GuiDisplay4 extends JFrame implements CardContainer, Display, NewCo
|
|||||||
|
|
||||||
playerPCLabel.setText("Poison Counters: " + AllZone.getHumanPlayer().getPoisonCounters());
|
playerPCLabel.setText("Poison Counters: " + AllZone.getHumanPlayer().getPoisonCounters());
|
||||||
AllZone.getHumanPlayer().addObserver(new Observer() {
|
AllZone.getHumanPlayer().addObserver(new Observer() {
|
||||||
public void update(Observable a, Object b) {
|
public void update(final Observable a, final Object b) {
|
||||||
int pcs = AllZone.getHumanPlayer().getPoisonCounters();
|
int pcs = AllZone.getHumanPlayer().getPoisonCounters();
|
||||||
playerPCLabel.setText("Poison Counters: " + pcs);
|
playerPCLabel.setText("Poison Counters: " + pcs);
|
||||||
}
|
}
|
||||||
@@ -692,7 +714,7 @@ public class GuiDisplay4 extends JFrame implements CardContainer, Display, NewCo
|
|||||||
|
|
||||||
//stack
|
//stack
|
||||||
AllZone.getStack().addObserver(new Observer() {
|
AllZone.getStack().addObserver(new Observer() {
|
||||||
public void update(Observable a, Object b) {
|
public void update(final Observable a, final Object b) {
|
||||||
stackPanel.removeAll();
|
stackPanel.removeAll();
|
||||||
MagicStack stack = AllZone.getStack();
|
MagicStack stack = AllZone.getStack();
|
||||||
int count = 1;
|
int count = 1;
|
||||||
@@ -708,7 +730,7 @@ public class GuiDisplay4 extends JFrame implements CardContainer, Display, NewCo
|
|||||||
cardPanel.addMouseMotionListener(new MouseMotionAdapter() {
|
cardPanel.addMouseMotionListener(new MouseMotionAdapter() {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void mouseMoved(MouseEvent me) {
|
public void mouseMoved(final MouseEvent me) {
|
||||||
setCard(cardPanel.getCard());
|
setCard(cardPanel.getCard());
|
||||||
} //mouseMoved
|
} //mouseMoved
|
||||||
});
|
});
|
||||||
@@ -729,22 +751,22 @@ public class GuiDisplay4 extends JFrame implements CardContainer, Display, NewCo
|
|||||||
|
|
||||||
//self hand
|
//self hand
|
||||||
AllZone.getHumanHand().addObserver(new Observer() {
|
AllZone.getHumanHand().addObserver(new Observer() {
|
||||||
public void update(Observable a, Object b) {
|
public void update(final Observable a, final Object b) {
|
||||||
PlayerZone pZone = (PlayerZone) a;
|
PlayerZone pZone = (PlayerZone) a;
|
||||||
HandArea p = playerHandPanel;
|
HandArea p = playerHandPanel;
|
||||||
;
|
|
||||||
|
|
||||||
Card c[] = AllZoneUtil.getCardsInZone(pZone).toArray();
|
Card[] c = AllZoneUtil.getCardsInZone(pZone).toArray();
|
||||||
|
|
||||||
List<Card> tmp, diff;
|
List<Card> tmp, diff;
|
||||||
tmp = new ArrayList<Card>();
|
tmp = new ArrayList<Card>();
|
||||||
for (arcane.ui.CardPanel cpa : p.cardPanels)
|
for (arcane.ui.CardPanel cpa : p.cardPanels) {
|
||||||
tmp.add(cpa.gameCard);
|
tmp.add(cpa.gameCard);
|
||||||
|
}
|
||||||
diff = new ArrayList<Card>(tmp);
|
diff = new ArrayList<Card>(tmp);
|
||||||
diff.removeAll(Arrays.asList(c));
|
diff.removeAll(Arrays.asList(c));
|
||||||
if (diff.size() == p.cardPanels.size())
|
if (diff.size() == p.cardPanels.size()) {
|
||||||
p.clear();
|
p.clear();
|
||||||
else {
|
} else {
|
||||||
for (Card card : diff) {
|
for (Card card : diff) {
|
||||||
p.removeCardPanel(p.getCardPanel(card.getUniqueNumber()));
|
p.removeCardPanel(p.getCardPanel(card.getUniqueNumber()));
|
||||||
}
|
}
|
||||||
@@ -754,7 +776,8 @@ public class GuiDisplay4 extends JFrame implements CardContainer, Display, NewCo
|
|||||||
|
|
||||||
int fromZoneX = 0, fromZoneY = 0;
|
int fromZoneX = 0, fromZoneY = 0;
|
||||||
Rectangle pb = playerLibraryValue.getBounds();
|
Rectangle pb = playerLibraryValue.getBounds();
|
||||||
Point zoneLocation = SwingUtilities.convertPoint(playerLibraryValue, Math.round(pb.width / 2.0f), Math.round(pb.height / 2.0f), layeredPane);
|
Point zoneLocation = SwingUtilities.convertPoint(playerLibraryValue, Math.round(pb.width / 2.0f),
|
||||||
|
Math.round(pb.height / 2.0f), layeredPane);
|
||||||
fromZoneX = zoneLocation.x;
|
fromZoneX = zoneLocation.x;
|
||||||
fromZoneY = zoneLocation.y;
|
fromZoneY = zoneLocation.y;
|
||||||
int startWidth, startX, startY;
|
int startWidth, startX, startY;
|
||||||
@@ -772,22 +795,24 @@ public class GuiDisplay4 extends JFrame implements CardContainer, Display, NewCo
|
|||||||
endX = toPos.x;
|
endX = toPos.x;
|
||||||
endY = toPos.y;
|
endY = toPos.y;
|
||||||
arcane.ui.CardPanel animationPanel = new arcane.ui.CardPanel(card);
|
arcane.ui.CardPanel animationPanel = new arcane.ui.CardPanel(card);
|
||||||
if (isShowing())
|
if (isShowing()) {
|
||||||
Animation.moveCard(startX, startY, startWidth, endX, endY, endWidth, animationPanel, toPanel, layeredPane, 500);
|
Animation.moveCard(startX, startY, startWidth, endX, endY,
|
||||||
else
|
endWidth, animationPanel, toPanel, layeredPane, 500);
|
||||||
|
} else {
|
||||||
Animation.moveCard(toPanel);
|
Animation.moveCard(toPanel);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
});
|
});
|
||||||
AllZone.getHumanHand().updateObservers();
|
AllZone.getHumanHand().updateObservers();
|
||||||
//END, self hand
|
//END, self hand
|
||||||
|
|
||||||
//self play
|
//self play
|
||||||
AllZone.getHumanBattlefield().addObserver(new Observer() {
|
AllZone.getHumanBattlefield().addObserver(new Observer() {
|
||||||
public void update(Observable a, Object b) {
|
public void update(final Observable a, final Object b) {
|
||||||
PlayerZone pZone = (PlayerZone) a;
|
PlayerZone pZone = (PlayerZone) a;
|
||||||
|
|
||||||
Card c[] = AllZoneUtil.getCardsInZone(pZone).toArray();
|
Card[] c = AllZoneUtil.getCardsInZone(pZone).toArray();
|
||||||
|
|
||||||
GuiDisplayUtil.setupPlayZone(playerPlayPanel, c);
|
GuiDisplayUtil.setupPlayZone(playerPlayPanel, c);
|
||||||
}
|
}
|
||||||
@@ -798,10 +823,10 @@ public class GuiDisplay4 extends JFrame implements CardContainer, Display, NewCo
|
|||||||
|
|
||||||
//computer play
|
//computer play
|
||||||
AllZone.getComputerBattlefield().addObserver(new Observer() {
|
AllZone.getComputerBattlefield().addObserver(new Observer() {
|
||||||
public void update(Observable a, Object b) {
|
public void update(final Observable a, final Object b) {
|
||||||
PlayerZone pZone = (PlayerZone) a;
|
PlayerZone pZone = (PlayerZone) a;
|
||||||
|
|
||||||
Card c[] = AllZoneUtil.getCardsInZone(pZone).toArray();
|
Card[] c = AllZoneUtil.getCardsInZone(pZone).toArray();
|
||||||
|
|
||||||
GuiDisplayUtil.setupPlayZone(oppPlayPanel, c);
|
GuiDisplayUtil.setupPlayZone(oppPlayPanel, c);
|
||||||
}
|
}
|
||||||
@@ -1082,14 +1107,14 @@ public class GuiDisplay4 extends JFrame implements CardContainer, Display, NewCo
|
|||||||
|
|
||||||
cancelButton.setText("Cancel");
|
cancelButton.setText("Cancel");
|
||||||
cancelButton.addActionListener(new ActionListener() {
|
cancelButton.addActionListener(new ActionListener() {
|
||||||
public void actionPerformed(ActionEvent evt) {
|
public void actionPerformed(final ActionEvent evt) {
|
||||||
cancelButtonActionPerformed(evt);
|
cancelButtonActionPerformed(evt);
|
||||||
okButton.requestFocusInWindow();
|
okButton.requestFocusInWindow();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
okButton.setText("OK");
|
okButton.setText("OK");
|
||||||
okButton.addActionListener(new ActionListener() {
|
okButton.addActionListener(new ActionListener() {
|
||||||
public void actionPerformed(ActionEvent evt) {
|
public void actionPerformed(final ActionEvent evt) {
|
||||||
okButtonActionPerformed(evt);
|
okButtonActionPerformed(evt);
|
||||||
|
|
||||||
if (AllZone.getPhase().isNeedToNextPhase()) {
|
if (AllZone.getPhase().isNeedToNextPhase()) {
|
||||||
@@ -1102,7 +1127,7 @@ public class GuiDisplay4 extends JFrame implements CardContainer, Display, NewCo
|
|||||||
});
|
});
|
||||||
okButton.addKeyListener(new KeyAdapter() {
|
okButton.addKeyListener(new KeyAdapter() {
|
||||||
@Override
|
@Override
|
||||||
public void keyPressed(KeyEvent arg0) {
|
public void keyPressed(final KeyEvent arg0) {
|
||||||
// TODO make triggers on escape
|
// TODO make triggers on escape
|
||||||
int code = arg0.getKeyCode();
|
int code = arg0.getKeyCode();
|
||||||
if (code == KeyEvent.VK_ESCAPE) {
|
if (code == KeyEvent.VK_ESCAPE) {
|
||||||
@@ -1140,13 +1165,17 @@ public class GuiDisplay4 extends JFrame implements CardContainer, Display, NewCo
|
|||||||
oppPCLabel.setForeground(greenColor);
|
oppPCLabel.setForeground(greenColor);
|
||||||
|
|
||||||
JLabel oppHandLabel = new JLabel(ForgeProps.getLocalized(COMPUTER_HAND.BUTTON), SwingConstants.TRAILING);
|
JLabel oppHandLabel = new JLabel(ForgeProps.getLocalized(COMPUTER_HAND.BUTTON), SwingConstants.TRAILING);
|
||||||
if (!OldGuiNewGame.useLAFFonts.isSelected()) oppHandLabel.setFont(statFont);
|
if (!OldGuiNewGame.useLAFFonts.isSelected()) {
|
||||||
|
oppHandLabel.setFont(statFont);
|
||||||
|
}
|
||||||
|
|
||||||
JButton oppGraveButton = new JButton(COMPUTER_GRAVEYARD_ACTION);
|
JButton oppGraveButton = new JButton(COMPUTER_GRAVEYARD_ACTION);
|
||||||
oppGraveButton.setText((String) COMPUTER_GRAVEYARD_ACTION.getValue("buttonText"));
|
oppGraveButton.setText((String) COMPUTER_GRAVEYARD_ACTION.getValue("buttonText"));
|
||||||
oppGraveButton.setMargin(new Insets(0, 0, 0, 0));
|
oppGraveButton.setMargin(new Insets(0, 0, 0, 0));
|
||||||
oppGraveButton.setHorizontalAlignment(SwingConstants.TRAILING);
|
oppGraveButton.setHorizontalAlignment(SwingConstants.TRAILING);
|
||||||
if (!OldGuiNewGame.useLAFFonts.isSelected()) oppGraveButton.setFont(statFont);
|
if (!OldGuiNewGame.useLAFFonts.isSelected()) {
|
||||||
|
oppGraveButton.setFont(statFont);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
JPanel gravePanel = new JPanel(new BorderLayout());
|
JPanel gravePanel = new JPanel(new BorderLayout());
|
||||||
@@ -1156,7 +1185,9 @@ public class GuiDisplay4 extends JFrame implements CardContainer, Display, NewCo
|
|||||||
oppRemovedButton.setText((String) COMPUTER_REMOVED_ACTION.getValue("buttonText"));
|
oppRemovedButton.setText((String) COMPUTER_REMOVED_ACTION.getValue("buttonText"));
|
||||||
oppRemovedButton.setMargin(new Insets(0, 0, 0, 0));
|
oppRemovedButton.setMargin(new Insets(0, 0, 0, 0));
|
||||||
//removedButton.setHorizontalAlignment(SwingConstants.TRAILING);
|
//removedButton.setHorizontalAlignment(SwingConstants.TRAILING);
|
||||||
if (!OldGuiNewGame.useLAFFonts.isSelected()) oppRemovedButton.setFont(statFont);
|
if (!OldGuiNewGame.useLAFFonts.isSelected()) {
|
||||||
|
oppRemovedButton.setFont(statFont);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
oppHandValue.setHorizontalAlignment(SwingConstants.LEADING);
|
oppHandValue.setHorizontalAlignment(SwingConstants.LEADING);
|
||||||
@@ -1225,24 +1256,32 @@ public class GuiDisplay4 extends JFrame implements CardContainer, Display, NewCo
|
|||||||
|
|
||||||
JLabel playerLibraryLabel = new JLabel(ForgeProps.getLocalized(HUMAN_LIBRARY.BUTTON),
|
JLabel playerLibraryLabel = new JLabel(ForgeProps.getLocalized(HUMAN_LIBRARY.BUTTON),
|
||||||
SwingConstants.TRAILING);
|
SwingConstants.TRAILING);
|
||||||
if (!OldGuiNewGame.useLAFFonts.isSelected()) playerLibraryLabel.setFont(statFont);
|
if (!OldGuiNewGame.useLAFFonts.isSelected()) {
|
||||||
|
playerLibraryLabel.setFont(statFont);
|
||||||
|
}
|
||||||
|
|
||||||
JLabel playerHandLabel = new JLabel(ForgeProps.getLocalized(HUMAN_HAND.TITLE), SwingConstants.TRAILING);
|
JLabel playerHandLabel = new JLabel(ForgeProps.getLocalized(HUMAN_HAND.TITLE), SwingConstants.TRAILING);
|
||||||
if (!OldGuiNewGame.useLAFFonts.isSelected()) playerHandLabel.setFont(statFont);
|
if (!OldGuiNewGame.useLAFFonts.isSelected()) {
|
||||||
|
playerHandLabel.setFont(statFont);
|
||||||
|
}
|
||||||
|
|
||||||
//JLabel playerGraveLabel = new JLabel("Grave:", SwingConstants.TRAILING);
|
//JLabel playerGraveLabel = new JLabel("Grave:", SwingConstants.TRAILING);
|
||||||
JButton playerGraveButton = new JButton(HUMAN_GRAVEYARD_ACTION);
|
JButton playerGraveButton = new JButton(HUMAN_GRAVEYARD_ACTION);
|
||||||
playerGraveButton.setText((String) HUMAN_GRAVEYARD_ACTION.getValue("buttonText"));
|
playerGraveButton.setText((String) HUMAN_GRAVEYARD_ACTION.getValue("buttonText"));
|
||||||
playerGraveButton.setMargin(new Insets(0, 0, 0, 0));
|
playerGraveButton.setMargin(new Insets(0, 0, 0, 0));
|
||||||
playerGraveButton.setHorizontalAlignment(SwingConstants.TRAILING);
|
playerGraveButton.setHorizontalAlignment(SwingConstants.TRAILING);
|
||||||
if (!OldGuiNewGame.useLAFFonts.isSelected()) playerGraveButton.setFont(statFont);
|
if (!OldGuiNewGame.useLAFFonts.isSelected()) {
|
||||||
|
playerGraveButton.setFont(statFont);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
JButton playerFlashBackButton = new JButton(HUMAN_FLASHBACK_ACTION);
|
JButton playerFlashBackButton = new JButton(HUMAN_FLASHBACK_ACTION);
|
||||||
playerFlashBackButton.setText((String) HUMAN_FLASHBACK_ACTION.getValue("buttonText"));
|
playerFlashBackButton.setText((String) HUMAN_FLASHBACK_ACTION.getValue("buttonText"));
|
||||||
playerFlashBackButton.setMargin(new Insets(0, 0, 0, 0));
|
playerFlashBackButton.setMargin(new Insets(0, 0, 0, 0));
|
||||||
playerFlashBackButton.setHorizontalAlignment(SwingConstants.TRAILING);
|
playerFlashBackButton.setHorizontalAlignment(SwingConstants.TRAILING);
|
||||||
if (!OldGuiNewGame.useLAFFonts.isSelected()) playerFlashBackButton.setFont(statFont);
|
if (!OldGuiNewGame.useLAFFonts.isSelected()) {
|
||||||
|
playerFlashBackButton.setFont(statFont);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
JPanel gravePanel = new JPanel(new BorderLayout());
|
JPanel gravePanel = new JPanel(new BorderLayout());
|
||||||
@@ -1255,7 +1294,9 @@ public class GuiDisplay4 extends JFrame implements CardContainer, Display, NewCo
|
|||||||
playerRemovedButton.setText((String) HUMAN_REMOVED_ACTION.getValue("buttonText"));
|
playerRemovedButton.setText((String) HUMAN_REMOVED_ACTION.getValue("buttonText"));
|
||||||
playerRemovedButton.setMargin(new Insets(0, 0, 0, 0));
|
playerRemovedButton.setMargin(new Insets(0, 0, 0, 0));
|
||||||
//removedButton.setHorizontalAlignment(SwingConstants.TRAILING);
|
//removedButton.setHorizontalAlignment(SwingConstants.TRAILING);
|
||||||
if (!OldGuiNewGame.useLAFFonts.isSelected()) playerRemovedButton.setFont(statFont);
|
if (!OldGuiNewGame.useLAFFonts.isSelected()) {
|
||||||
|
playerRemovedButton.setFont(statFont);
|
||||||
|
}
|
||||||
|
|
||||||
playerHandValue.setHorizontalAlignment(SwingConstants.LEADING);
|
playerHandValue.setHorizontalAlignment(SwingConstants.LEADING);
|
||||||
playerLibraryValue.setHorizontalAlignment(SwingConstants.LEADING);
|
playerLibraryValue.setHorizontalAlignment(SwingConstants.LEADING);
|
||||||
@@ -1316,7 +1357,7 @@ public class GuiDisplay4 extends JFrame implements CardContainer, Display, NewCo
|
|||||||
*
|
*
|
||||||
* @param pane a {@link javax.swing.JPanel} object.
|
* @param pane a {@link javax.swing.JPanel} object.
|
||||||
*/
|
*/
|
||||||
private void initCardPicture(JPanel pane) {
|
private void initCardPicture(final JPanel pane) {
|
||||||
pane.add(new ExternalPanel(detail), "detail");
|
pane.add(new ExternalPanel(detail), "detail");
|
||||||
pane.add(new ExternalPanel(picturePanel), "picture");
|
pane.add(new ExternalPanel(picturePanel), "picture");
|
||||||
picturePanel.setCardPanel(picture);
|
picturePanel.setCardPanel(picture);
|
||||||
@@ -1327,7 +1368,7 @@ public class GuiDisplay4 extends JFrame implements CardContainer, Display, NewCo
|
|||||||
*
|
*
|
||||||
* @param evt a {@link java.awt.event.ActionEvent} object.
|
* @param evt a {@link java.awt.event.ActionEvent} object.
|
||||||
*/
|
*/
|
||||||
private void cancelButtonActionPerformed(ActionEvent evt) {
|
private void cancelButtonActionPerformed(final ActionEvent evt) {
|
||||||
inputControl.selectButtonCancel();
|
inputControl.selectButtonCancel();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1336,12 +1377,12 @@ public class GuiDisplay4 extends JFrame implements CardContainer, Display, NewCo
|
|||||||
*
|
*
|
||||||
* @param evt a {@link java.awt.event.ActionEvent} object.
|
* @param evt a {@link java.awt.event.ActionEvent} object.
|
||||||
*/
|
*/
|
||||||
private void okButtonActionPerformed(ActionEvent evt) {
|
private void okButtonActionPerformed(final ActionEvent evt) {
|
||||||
inputControl.selectButtonOK();
|
inputControl.selectButtonOK();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Exit the Application
|
* Exit the Application.
|
||||||
*/
|
*/
|
||||||
private void concede() {
|
private void concede() {
|
||||||
AllZone.getHumanPlayer().concede();
|
AllZone.getHumanPlayer().concede();
|
||||||
@@ -1350,30 +1391,32 @@ public class GuiDisplay4 extends JFrame implements CardContainer, Display, NewCo
|
|||||||
|
|
||||||
// ********** Phase stuff in Display ******************
|
// ********** Phase stuff in Display ******************
|
||||||
/** {@inheritDoc} */
|
/** {@inheritDoc} */
|
||||||
public boolean stopAtPhase(Player turn, String phase) {
|
public final boolean stopAtPhase(final Player turn, final String phase) {
|
||||||
if (turn.isComputer()) {
|
if (turn.isComputer()) {
|
||||||
if (phase.equals(Constant.Phase.End_Of_Turn))
|
if (phase.equals(Constant.Phase.End_Of_Turn)) {
|
||||||
return cbAIEndOfTurn.isSelected();
|
return cbAIEndOfTurn.isSelected();
|
||||||
else if (phase.equals(Constant.Phase.Upkeep))
|
} else if (phase.equals(Constant.Phase.Upkeep)) {
|
||||||
return cbAIUpkeep.isSelected();
|
return cbAIUpkeep.isSelected();
|
||||||
else if (phase.equals(Constant.Phase.Draw))
|
} else if (phase.equals(Constant.Phase.Draw)) {
|
||||||
return cbAIDraw.isSelected();
|
return cbAIDraw.isSelected();
|
||||||
else if (phase.equals(Constant.Phase.Combat_Begin))
|
} else if (phase.equals(Constant.Phase.Combat_Begin)) {
|
||||||
return cbAIBeginCombat.isSelected();
|
return cbAIBeginCombat.isSelected();
|
||||||
else if (phase.equals(Constant.Phase.Combat_End))
|
} else if (phase.equals(Constant.Phase.Combat_End)) {
|
||||||
return cbAIEndCombat.isSelected();
|
return cbAIEndCombat.isSelected();
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
if (phase.equals(Constant.Phase.End_Of_Turn))
|
if (phase.equals(Constant.Phase.End_Of_Turn)) {
|
||||||
return cbHumanEndOfTurn.isSelected();
|
return cbHumanEndOfTurn.isSelected();
|
||||||
else if (phase.equals(Constant.Phase.Upkeep))
|
} else if (phase.equals(Constant.Phase.Upkeep)) {
|
||||||
return cbHumanUpkeep.isSelected();
|
return cbHumanUpkeep.isSelected();
|
||||||
else if (phase.equals(Constant.Phase.Draw))
|
} else if (phase.equals(Constant.Phase.Draw)) {
|
||||||
return cbHumanDraw.isSelected();
|
return cbHumanDraw.isSelected();
|
||||||
else if (phase.equals(Constant.Phase.Combat_Begin))
|
} else if (phase.equals(Constant.Phase.Combat_Begin)) {
|
||||||
return cbHumanBeginCombat.isSelected();
|
return cbHumanBeginCombat.isSelected();
|
||||||
else if (phase.equals(Constant.Phase.Combat_End))
|
} else if (phase.equals(Constant.Phase.Combat_End)) {
|
||||||
return cbHumanEndCombat.isSelected();
|
return cbHumanEndCombat.isSelected();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1382,7 +1425,7 @@ public class GuiDisplay4 extends JFrame implements CardContainer, Display, NewCo
|
|||||||
*
|
*
|
||||||
* @return a boolean.
|
* @return a boolean.
|
||||||
*/
|
*/
|
||||||
public boolean loadPrefs() {
|
public final boolean loadPrefs() {
|
||||||
ForgePreferences fp = Singletons.getModel().getPreferences();
|
ForgePreferences fp = Singletons.getModel().getPreferences();
|
||||||
|
|
||||||
cbAIUpkeep.setSelected(fp.bAIUpkeep);
|
cbAIUpkeep.setSelected(fp.bAIUpkeep);
|
||||||
@@ -1407,7 +1450,7 @@ public class GuiDisplay4 extends JFrame implements CardContainer, Display, NewCo
|
|||||||
*
|
*
|
||||||
* @return a boolean.
|
* @return a boolean.
|
||||||
*/
|
*/
|
||||||
public boolean savePrefs() {
|
public final boolean savePrefs() {
|
||||||
Constant.Runtime.Mill[0] = canLoseByDecking.isSelected();
|
Constant.Runtime.Mill[0] = canLoseByDecking.isSelected();
|
||||||
ForgePreferences fp = Singletons.getModel().getPreferences();
|
ForgePreferences fp = Singletons.getModel().getPreferences();
|
||||||
|
|
||||||
@@ -1443,13 +1486,13 @@ public class GuiDisplay4 extends JFrame implements CardContainer, Display, NewCo
|
|||||||
/** Constant <code>cbAIEndCombat</code> */
|
/** Constant <code>cbAIEndCombat</code> */
|
||||||
public static JCheckBoxMenuItem cbAIEndCombat = new JCheckBoxMenuItem("End Combat", true);
|
public static JCheckBoxMenuItem cbAIEndCombat = new JCheckBoxMenuItem("End Combat", true);
|
||||||
|
|
||||||
/** Constant <code>cbHumanUpkeep</code> */
|
/** Constant <code>cbHumanUpkeep</code>. */
|
||||||
public static JCheckBoxMenuItem cbHumanUpkeep = new JCheckBoxMenuItem("Upkeep", true);
|
public static JCheckBoxMenuItem cbHumanUpkeep = new JCheckBoxMenuItem("Upkeep", true);
|
||||||
/** Constant <code>cbHumanDraw</code> */
|
/** Constant <code>cbHumanDraw</code>. */
|
||||||
public static JCheckBoxMenuItem cbHumanDraw = new JCheckBoxMenuItem("Draw", true);
|
public static JCheckBoxMenuItem cbHumanDraw = new JCheckBoxMenuItem("Draw", true);
|
||||||
/** Constant <code>cbHumanEndOfTurn</code> */
|
/** Constant <code>cbHumanEndOfTurn</code>. */
|
||||||
public static JCheckBoxMenuItem cbHumanEndOfTurn = new JCheckBoxMenuItem("End of Turn", true);
|
public static JCheckBoxMenuItem cbHumanEndOfTurn = new JCheckBoxMenuItem("End of Turn", true);
|
||||||
/** Constant <code>cbHumanBeginCombat</code> */
|
/** Constant <code>cbHumanBeginCombat</code>. */
|
||||||
public static JCheckBoxMenuItem cbHumanBeginCombat = new JCheckBoxMenuItem("Begin Combat", true);
|
public static JCheckBoxMenuItem cbHumanBeginCombat = new JCheckBoxMenuItem("Begin Combat", true);
|
||||||
/** Constant <code>cbHumanEndCombat</code> */
|
/** Constant <code>cbHumanEndCombat</code> */
|
||||||
public static JCheckBoxMenuItem cbHumanEndCombat = new JCheckBoxMenuItem("End Combat", true);
|
public static JCheckBoxMenuItem cbHumanEndCombat = new JCheckBoxMenuItem("End Combat", true);
|
||||||
@@ -1458,57 +1501,57 @@ public class GuiDisplay4 extends JFrame implements CardContainer, Display, NewCo
|
|||||||
|
|
||||||
// ****** Developer Mode *******
|
// ****** Developer Mode *******
|
||||||
|
|
||||||
/** Constant <code>canLoseByDecking</code> */
|
/** Constant <code>canLoseByDecking</code>. */
|
||||||
public static JCheckBoxMenuItem canLoseByDecking = new JCheckBoxMenuItem("Lose by Decking", true);
|
public static JCheckBoxMenuItem canLoseByDecking = new JCheckBoxMenuItem("Lose by Decking", true);
|
||||||
|
|
||||||
// *****************************
|
// *****************************
|
||||||
|
|
||||||
|
|
||||||
JXMultiSplitPane pane = new JXMultiSplitPane();
|
private JXMultiSplitPane pane = new JXMultiSplitPane();
|
||||||
JButton cancelButton = new JButton();
|
private JButton cancelButton = new JButton();
|
||||||
JButton okButton = new JButton();
|
private JButton okButton = new JButton();
|
||||||
JTextArea messageArea = new JTextArea(1, 10);
|
private JTextArea messageArea = new JTextArea(1, 10);
|
||||||
JTextArea combatArea = new JTextArea();
|
private JTextArea combatArea = new JTextArea();
|
||||||
JPanel stackPanel = new JPanel();
|
private JPanel stackPanel = new JPanel();
|
||||||
PlayArea oppPlayPanel = null;
|
private PlayArea oppPlayPanel = null;
|
||||||
PlayArea playerPlayPanel = null;
|
private PlayArea playerPlayPanel = null;
|
||||||
HandArea playerHandPanel = null;
|
private HandArea playerHandPanel = null;
|
||||||
//JPanel cdPanel = new JPanel();
|
//JPanel cdPanel = new JPanel();
|
||||||
JLabel oppLifeLabel = new JLabel();
|
private JLabel oppLifeLabel = new JLabel();
|
||||||
JLabel oppIconLabel = new JLabel();
|
private JLabel oppIconLabel = new JLabel();
|
||||||
JLabel playerLifeLabel = new JLabel();
|
private JLabel playerLifeLabel = new JLabel();
|
||||||
JLabel oppPCLabel = new JLabel();
|
private JLabel oppPCLabel = new JLabel();
|
||||||
JLabel playerPCLabel = new JLabel();
|
private JLabel playerPCLabel = new JLabel();
|
||||||
JLabel oppLibraryLabel = new JLabel(
|
private JLabel oppLibraryLabel = new JLabel(
|
||||||
ForgeProps.getLocalized(COMPUTER_LIBRARY.BUTTON),
|
ForgeProps.getLocalized(COMPUTER_LIBRARY.BUTTON),
|
||||||
SwingConstants.TRAILING);
|
SwingConstants.TRAILING);
|
||||||
JLabel oppHandValue = new JLabel();
|
private JLabel oppHandValue = new JLabel();
|
||||||
JLabel oppLibraryValue = new JLabel();
|
private JLabel oppLibraryValue = new JLabel();
|
||||||
JLabel oppGraveValue = new JLabel();
|
private JLabel oppGraveValue = new JLabel();
|
||||||
JLabel oppRemovedValue = new JLabel();
|
private JLabel oppRemovedValue = new JLabel();
|
||||||
JLabel playerHandValue = new JLabel();
|
private JLabel playerHandValue = new JLabel();
|
||||||
JLabel playerLibraryValue = new JLabel();
|
private JLabel playerLibraryValue = new JLabel();
|
||||||
JLabel playerGraveValue = new JLabel();
|
private JLabel playerGraveValue = new JLabel();
|
||||||
JLabel playerFBValue = new JLabel();
|
private JLabel playerFBValue = new JLabel();
|
||||||
JLabel playerRemovedValue = new JLabel();
|
private JLabel playerRemovedValue = new JLabel();
|
||||||
|
|
||||||
CardDetailPanel detail = new CardDetailPanel(null);
|
private CardDetailPanel detail = new CardDetailPanel(null);
|
||||||
ViewPanel picturePanel = new ViewPanel();
|
private ViewPanel picturePanel = new ViewPanel();
|
||||||
arcane.ui.CardPanel picture = new arcane.ui.CardPanel(null);
|
private arcane.ui.CardPanel picture = new arcane.ui.CardPanel(null);
|
||||||
JLayeredPane layeredPane = SwingUtilities.getRootPane(this).getLayeredPane();
|
private JLayeredPane layeredPane = SwingUtilities.getRootPane(this).getLayeredPane();
|
||||||
|
|
||||||
private class ZoneAction extends ForgeAction {
|
private class ZoneAction extends ForgeAction {
|
||||||
private static final long serialVersionUID = -5822976087772388839L;
|
private static final long serialVersionUID = -5822976087772388839L;
|
||||||
private PlayerZone zone;
|
private PlayerZone zone;
|
||||||
private String title;
|
private String title;
|
||||||
|
|
||||||
public ZoneAction(PlayerZone zone, String property) {
|
public ZoneAction(final PlayerZone zone, final String property) {
|
||||||
super(property);
|
super(property);
|
||||||
title = ForgeProps.getLocalized(property + "/title");
|
title = ForgeProps.getLocalized(property + "/title");
|
||||||
this.zone = zone;
|
this.zone = zone;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void actionPerformed(ActionEvent e) {
|
public void actionPerformed(final ActionEvent e) {
|
||||||
Generator<Card> c = YieldUtils.toGenerator(getCardsAsIterable());
|
Generator<Card> c = YieldUtils.toGenerator(getCardsAsIterable());
|
||||||
|
|
||||||
if (AllZone.getNameChanger().shouldChangeCardName()) {
|
if (AllZone.getNameChanger().shouldChangeCardName()) {
|
||||||
@@ -1541,13 +1584,15 @@ public class GuiDisplay4 extends JFrame implements CardContainer, Display, NewCo
|
|||||||
}
|
}
|
||||||
//System.out.println("Face down cards replaced: "+choices2);
|
//System.out.println("Face down cards replaced: "+choices2);
|
||||||
Card choice = (Card) GuiUtils.getChoiceOptional(title, choices2.toArray());
|
Card choice = (Card) GuiUtils.getChoiceOptional(title, choices2.toArray());
|
||||||
if (choice != null) doAction(choice);
|
if (choice != null) {
|
||||||
|
doAction(choice);
|
||||||
/*
|
/*
|
||||||
Card choice = GuiUtils.getChoiceOptional(title, iter);
|
Card choice = GuiUtils.getChoiceOptional(title, iter);
|
||||||
if (choice != null) doAction(choice);
|
if (choice != null) doAction(choice);
|
||||||
*/
|
*/
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @deprecated
|
* @deprecated
|
||||||
@@ -1562,7 +1607,7 @@ public class GuiDisplay4 extends JFrame implements CardContainer, Display, NewCo
|
|||||||
return new ImmutableIterableFrom<Card>(AllZoneUtil.getCardsInZone(zone));
|
return new ImmutableIterableFrom<Card>(AllZoneUtil.getCardsInZone(zone));
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void doAction(Card c) {
|
protected void doAction(final Card c) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1574,19 +1619,19 @@ public class GuiDisplay4 extends JFrame implements CardContainer, Display, NewCo
|
|||||||
super(CONCEDE);
|
super(CONCEDE);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void actionPerformed(ActionEvent e) {
|
public void actionPerformed(final ActionEvent e) {
|
||||||
concede();
|
concede();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private class DeckListAction extends ForgeAction {
|
private class DeckListAction extends ForgeAction {
|
||||||
public DeckListAction(String property) {
|
public DeckListAction(final String property) {
|
||||||
super(property);
|
super(property);
|
||||||
}
|
}
|
||||||
|
|
||||||
private static final long serialVersionUID = 9874492387239847L;
|
private static final long serialVersionUID = 9874492387239847L;
|
||||||
|
|
||||||
public void actionPerformed(ActionEvent e) {
|
public void actionPerformed(final ActionEvent e) {
|
||||||
if (Constant.Runtime.HumanDeck[0].countMain() > 1) {
|
if (Constant.Runtime.HumanDeck[0].countMain() > 1) {
|
||||||
HashMap<String, Integer> deckMap = new HashMap<String, Integer>();
|
HashMap<String, Integer> deckMap = new HashMap<String, Integer>();
|
||||||
|
|
||||||
@@ -1595,41 +1640,45 @@ public class GuiDisplay4 extends JFrame implements CardContainer, Display, NewCo
|
|||||||
}
|
}
|
||||||
|
|
||||||
String nl = System.getProperty("line.separator");
|
String nl = System.getProperty("line.separator");
|
||||||
StringBuilder DeckList = new StringBuilder();
|
StringBuilder deckList = new StringBuilder();
|
||||||
String dName = Constant.Runtime.HumanDeck[0].getName();
|
String dName = Constant.Runtime.HumanDeck[0].getName();
|
||||||
|
|
||||||
if (dName == null)
|
if (dName == null) {
|
||||||
dName = "";
|
dName = "";
|
||||||
else
|
} else {
|
||||||
DeckList.append(dName + nl);
|
deckList.append(dName + nl);
|
||||||
|
}
|
||||||
|
|
||||||
ArrayList<String> dmKeys = new ArrayList<String>();
|
ArrayList<String> dmKeys = new ArrayList<String>();
|
||||||
for (String s : deckMap.keySet())
|
for (String s : deckMap.keySet()) {
|
||||||
dmKeys.add(s);
|
dmKeys.add(s);
|
||||||
|
}
|
||||||
|
|
||||||
Collections.sort(dmKeys);
|
Collections.sort(dmKeys);
|
||||||
|
|
||||||
for (String s : dmKeys) {
|
for (String s : dmKeys) {
|
||||||
DeckList.append(deckMap.get(s) + " x " + s + nl);
|
deckList.append(deckMap.get(s) + " x " + s + nl);
|
||||||
}
|
}
|
||||||
|
|
||||||
int rcMsg = -1138;
|
int rcMsg = -1138;
|
||||||
String ttl = "Human's Decklist";
|
String ttl = "Human's Decklist";
|
||||||
if (!dName.equals(""))
|
if (!dName.equals("")) {
|
||||||
ttl += " - " + dName;
|
ttl += " - " + dName;
|
||||||
|
}
|
||||||
|
|
||||||
StringBuilder msg = new StringBuilder();
|
StringBuilder msg = new StringBuilder();
|
||||||
if (deckMap.keySet().size() <= 32)
|
if (deckMap.keySet().size() <= 32) {
|
||||||
msg.append(DeckList.toString() + nl);
|
msg.append(deckList.toString() + nl);
|
||||||
else
|
} else {
|
||||||
msg.append("Decklist too long for dialog." + nl + nl);
|
msg.append("Decklist too long for dialog." + nl + nl);
|
||||||
|
}
|
||||||
|
|
||||||
msg.append("Copy Decklist to Clipboard?");
|
msg.append("Copy Decklist to Clipboard?");
|
||||||
|
|
||||||
rcMsg = JOptionPane.showConfirmDialog(null, msg, ttl, JOptionPane.OK_CANCEL_OPTION);
|
rcMsg = JOptionPane.showConfirmDialog(null, msg, ttl, JOptionPane.OK_CANCEL_OPTION);
|
||||||
|
|
||||||
if (rcMsg == JOptionPane.OK_OPTION) {
|
if (rcMsg == JOptionPane.OK_OPTION) {
|
||||||
StringSelection ss = new StringSelection(DeckList.toString());
|
StringSelection ss = new StringSelection(deckList.toString());
|
||||||
Toolkit.getDefaultToolkit().getSystemClipboard().setContents(ss, null);
|
Toolkit.getDefaultToolkit().getSystemClipboard().setContents(ss, null);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -32,10 +32,10 @@ import static javax.swing.JOptionPane.PLAIN_MESSAGE;
|
|||||||
*/
|
*/
|
||||||
public class Gui_DownloadPictures_LQ extends DefaultBoundedRangeModel implements Runnable, NewConstants, NewConstants.LANG.Gui_DownloadPictures {
|
public class Gui_DownloadPictures_LQ extends DefaultBoundedRangeModel implements Runnable, NewConstants, NewConstants.LANG.Gui_DownloadPictures {
|
||||||
|
|
||||||
/** Constant <code>serialVersionUID=-7890794857949935256L</code> */
|
/** Constant <code>serialVersionUID=-7890794857949935256L</code>. */
|
||||||
private static final long serialVersionUID = -7890794857949935256L;
|
private static final long serialVersionUID = -7890794857949935256L;
|
||||||
|
|
||||||
/** Constant <code>types</code> */
|
/** Constant <code>types</code>. */
|
||||||
public static final Proxy.Type[] types = Proxy.Type.values();
|
public static final Proxy.Type[] types = Proxy.Type.values();
|
||||||
|
|
||||||
//proxy
|
//proxy
|
||||||
@@ -56,7 +56,7 @@ public class Gui_DownloadPictures_LQ extends DefaultBoundedRangeModel implements
|
|||||||
*
|
*
|
||||||
* @param c an array of {@link forge.Gui_DownloadPictures_LQ.mCard} objects.
|
* @param c an array of {@link forge.Gui_DownloadPictures_LQ.mCard} objects.
|
||||||
*/
|
*/
|
||||||
private Gui_DownloadPictures_LQ(mCard[] c) {
|
private Gui_DownloadPictures_LQ(final mCard[] c) {
|
||||||
this.cards = c;
|
this.cards = c;
|
||||||
addr = new JTextField(ForgeProps.getLocalized(PROXY_ADDRESS));
|
addr = new JTextField(ForgeProps.getLocalized(PROXY_ADDRESS));
|
||||||
port = new JTextField(ForgeProps.getLocalized(PROXY_PORT));
|
port = new JTextField(ForgeProps.getLocalized(PROXY_PORT));
|
||||||
@@ -75,7 +75,9 @@ public class Gui_DownloadPictures_LQ extends DefaultBoundedRangeModel implements
|
|||||||
rb.addChangeListener(new ProxyHandler(i));
|
rb.addChangeListener(new ProxyHandler(i));
|
||||||
bg.add(rb);
|
bg.add(rb);
|
||||||
p0.add(rb);
|
p0.add(rb);
|
||||||
if (i == 0) rb.setSelected(true);
|
if (i == 0) {
|
||||||
|
rb.setSelected(true);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//Proxy config
|
//Proxy config
|
||||||
@@ -94,7 +96,7 @@ public class Gui_DownloadPictures_LQ extends DefaultBoundedRangeModel implements
|
|||||||
final JButton b = new JButton(ForgeProps.getLocalized(BUTTONS.START));
|
final JButton b = new JButton(ForgeProps.getLocalized(BUTTONS.START));
|
||||||
b.addActionListener(new ActionListener() {
|
b.addActionListener(new ActionListener() {
|
||||||
|
|
||||||
public void actionPerformed(ActionEvent e) {
|
public void actionPerformed(final ActionEvent e) {
|
||||||
new Thread(Gui_DownloadPictures_LQ.this).start();
|
new Thread(Gui_DownloadPictures_LQ.this).start();
|
||||||
b.setEnabled(false);
|
b.setEnabled(false);
|
||||||
}
|
}
|
||||||
@@ -146,7 +148,7 @@ public class Gui_DownloadPictures_LQ extends DefaultBoundedRangeModel implements
|
|||||||
*
|
*
|
||||||
* @param card a int.
|
* @param card a int.
|
||||||
*/
|
*/
|
||||||
private void update(int card) {
|
private void update(final int card) {
|
||||||
this.card = card;
|
this.card = card;
|
||||||
final class Worker implements Runnable {
|
final class Worker implements Runnable {
|
||||||
private int card;
|
private int card;
|
||||||
@@ -162,7 +164,7 @@ public class Gui_DownloadPictures_LQ extends DefaultBoundedRangeModel implements
|
|||||||
System.out.println(card + "/" + cards.length);
|
System.out.println(card + "/" + cards.length);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
;
|
|
||||||
EventQueue.invokeLater(new Worker(card));
|
EventQueue.invokeLater(new Worker(card));
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -172,7 +174,7 @@ public class Gui_DownloadPictures_LQ extends DefaultBoundedRangeModel implements
|
|||||||
* @param frame a {@link javax.swing.JFrame} object.
|
* @param frame a {@link javax.swing.JFrame} object.
|
||||||
* @return a {@link javax.swing.JDialog} object.
|
* @return a {@link javax.swing.JDialog} object.
|
||||||
*/
|
*/
|
||||||
public JDialog getDlg(JFrame frame) {
|
public JDialog getDlg(final JFrame frame) {
|
||||||
final JDialog dlg = this.dlg.createDialog(frame, ForgeProps.getLocalized(TITLE));
|
final JDialog dlg = this.dlg.createDialog(frame, ForgeProps.getLocalized(TITLE));
|
||||||
close.addActionListener(new ActionListener() {
|
close.addActionListener(new ActionListener() {
|
||||||
public void actionPerformed(ActionEvent e) {
|
public void actionPerformed(ActionEvent e) {
|
||||||
@@ -185,10 +187,10 @@ public class Gui_DownloadPictures_LQ extends DefaultBoundedRangeModel implements
|
|||||||
/**
|
/**
|
||||||
* <p>Setter for the field <code>cancel</code>.</p>
|
* <p>Setter for the field <code>cancel</code>.</p>
|
||||||
*
|
*
|
||||||
* @param cancel a boolean.
|
* @param cancelIn a boolean.
|
||||||
*/
|
*/
|
||||||
public void setCancel(boolean cancel) {
|
public void setCancel(final boolean cancelIn) {
|
||||||
this.cancel = cancel;
|
this.cancel = cancelIn;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -202,8 +204,10 @@ public class Gui_DownloadPictures_LQ extends DefaultBoundedRangeModel implements
|
|||||||
File base = ForgeProps.getFile(IMAGE_BASE);
|
File base = ForgeProps.getFile(IMAGE_BASE);
|
||||||
|
|
||||||
Proxy p = null;
|
Proxy p = null;
|
||||||
if (type == 0) p = Proxy.NO_PROXY;
|
if (type == 0) {
|
||||||
else try {
|
p = Proxy.NO_PROXY;
|
||||||
|
} else {
|
||||||
|
try {
|
||||||
p = new Proxy(types[type], new InetSocketAddress(addr.getText(), parseInt(port.getText())));
|
p = new Proxy(types[type], new InetSocketAddress(addr.getText(), parseInt(port.getText())));
|
||||||
} catch (Exception ex) {
|
} catch (Exception ex) {
|
||||||
ErrorViewer.showError(ex, ForgeProps.getLocalized(ERRORS.PROXY_CONNECT), addr.getText(),
|
ErrorViewer.showError(ex, ForgeProps.getLocalized(ERRORS.PROXY_CONNECT), addr.getText(),
|
||||||
@@ -211,6 +215,7 @@ public class Gui_DownloadPictures_LQ extends DefaultBoundedRangeModel implements
|
|||||||
// throw new RuntimeException("Gui_DownloadPictures : error 1 - " +ex);
|
// throw new RuntimeException("Gui_DownloadPictures : error 1 - " +ex);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (p != null) {
|
if (p != null) {
|
||||||
byte[] buf = new byte[1024];
|
byte[] buf = new byte[1024];
|
||||||
@@ -274,7 +279,7 @@ public class Gui_DownloadPictures_LQ extends DefaultBoundedRangeModel implements
|
|||||||
*
|
*
|
||||||
* @param frame a {@link javax.swing.JFrame} object.
|
* @param frame a {@link javax.swing.JFrame} object.
|
||||||
*/
|
*/
|
||||||
public static void startDownload(JFrame frame) {
|
public static void startDownload(final JFrame frame) {
|
||||||
final mCard[] card = getNeededCards();
|
final mCard[] card = getNeededCards();
|
||||||
|
|
||||||
if (card.length == 0) {
|
if (card.length == 0) {
|
||||||
@@ -299,19 +304,21 @@ public class Gui_DownloadPictures_LQ extends DefaultBoundedRangeModel implements
|
|||||||
//mCard[] cardPlay = readFile(CARD_PICTURES);
|
//mCard[] cardPlay = readFile(CARD_PICTURES);
|
||||||
//mCard[] cardTokenLQ = readFile(CARD_PICTURES_TOKEN_LQ);
|
//mCard[] cardTokenLQ = readFile(CARD_PICTURES_TOKEN_LQ);
|
||||||
|
|
||||||
ArrayList<mCard> CList = new ArrayList<mCard>();
|
ArrayList<mCard> cList = new ArrayList<mCard>();
|
||||||
|
|
||||||
for (Card c : AllZone.getCardFactory()) {
|
for (Card c : AllZone.getCardFactory()) {
|
||||||
String url = c.getSVar("Picture");
|
String url = c.getSVar("Picture");
|
||||||
String[] URLs = url.split("\\\\");
|
String[] URLs = url.split("\\\\");
|
||||||
|
|
||||||
String iName = GuiDisplayUtil.cleanString(c.getImageName());
|
String iName = GuiDisplayUtil.cleanString(c.getImageName());
|
||||||
CList.add(new mCard(iName + ".jpg", URLs[0]));
|
cList.add(new mCard(iName + ".jpg", URLs[0]));
|
||||||
//Log.error(iName + ".jpg" + "\t" + URLs[0]);
|
//Log.error(iName + ".jpg" + "\t" + URLs[0]);
|
||||||
|
|
||||||
if (URLs.length > 1)
|
if (URLs.length > 1) {
|
||||||
for (int j = 1; j < URLs.length; j++)
|
for (int j = 1; j < URLs.length; j++) {
|
||||||
CList.add(new mCard(iName + j + ".jpg", URLs[j]));
|
cList.add(new mCard(iName + j + ".jpg", URLs[j]));
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ArrayList<mCard> list = new ArrayList<mCard>();
|
ArrayList<mCard> list = new ArrayList<mCard>();
|
||||||
@@ -319,13 +326,14 @@ public class Gui_DownloadPictures_LQ extends DefaultBoundedRangeModel implements
|
|||||||
|
|
||||||
File base = ForgeProps.getFile(IMAGE_BASE);
|
File base = ForgeProps.getFile(IMAGE_BASE);
|
||||||
mCard[] a = {new mCard("", "")};
|
mCard[] a = {new mCard("", "")};
|
||||||
mCard[] cardPlay = CList.toArray(a);
|
mCard[] cardPlay = cList.toArray(a);
|
||||||
//check to see which cards we already have
|
//check to see which cards we already have
|
||||||
for (int i = 0; i < cardPlay.length; i++) {
|
for (int i = 0; i < cardPlay.length; i++) {
|
||||||
file = new File(base, cardPlay[i].name);
|
file = new File(base, cardPlay[i].name);
|
||||||
if (!file.exists())
|
if (!file.exists()) {
|
||||||
list.add(cardPlay[i]);
|
list.add(cardPlay[i]);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
// base = ForgeProps.getFile(IMAGE_TOKEN);
|
// base = ForgeProps.getFile(IMAGE_TOKEN);
|
||||||
// for (int i = 0; i < cardTokenLQ.length; i++) {
|
// for (int i = 0; i < cardTokenLQ.length; i++) {
|
||||||
// file = new File(base, cardTokenLQ[i].name.substring(3, cardTokenLQ[i].name.length()));
|
// file = new File(base, cardTokenLQ[i].name.substring(3, cardTokenLQ[i].name.length()));
|
||||||
@@ -376,11 +384,11 @@ public class Gui_DownloadPictures_LQ extends DefaultBoundedRangeModel implements
|
|||||||
private class ProxyHandler implements ChangeListener {
|
private class ProxyHandler implements ChangeListener {
|
||||||
private int type;
|
private int type;
|
||||||
|
|
||||||
public ProxyHandler(int type) {
|
public ProxyHandler(final int typeIn) {
|
||||||
this.type = type;
|
this.type = typeIn;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void stateChanged(ChangeEvent e) {
|
public void stateChanged(final ChangeEvent e) {
|
||||||
if (((AbstractButton) e.getSource()).isSelected()) {
|
if (((AbstractButton) e.getSource()).isSelected()) {
|
||||||
Gui_DownloadPictures_LQ.this.type = type;
|
Gui_DownloadPictures_LQ.this.type = type;
|
||||||
addr.setEnabled(type != 0);
|
addr.setEnabled(type != 0);
|
||||||
@@ -390,10 +398,10 @@ public class Gui_DownloadPictures_LQ extends DefaultBoundedRangeModel implements
|
|||||||
}
|
}
|
||||||
|
|
||||||
private static class mCard {
|
private static class mCard {
|
||||||
final public String name;
|
public final String name;
|
||||||
final public String url;
|
public final String url;
|
||||||
|
|
||||||
mCard(String cardName, String cardURL) {
|
mCard(final String cardName, final String cardURL) {
|
||||||
name = cardName;
|
name = cardName;
|
||||||
url = cardURL;
|
url = cardURL;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user