- Hooking up Auto and Reset functions in Assign Damage

(I can't quite figure out how to get the alignment of the buttons to work, if some kind soul would like to add it, that'd be great)
This commit is contained in:
Sol
2012-10-15 03:30:47 +00:00
parent 355dd6c25a
commit a9cc0f8946

View File

@@ -69,7 +69,11 @@ public class VAssignDamage {
private Integer activeIndex = 0; private Integer activeIndex = 0;
private final JLabel lblTotalDamage = new FLabel.Builder().text("Available damage points: Unknown").build(); private final JLabel lblTotalDamage = new FLabel.Builder().text("Available damage points: Unknown").build();
// Label Buttons
private final FLabel lblOK = new FLabel.Builder().text("OK").hoverable(true).opaque(true).fontSize(16).build(); private final FLabel lblOK = new FLabel.Builder().text("OK").hoverable(true).opaque(true).fontSize(16).build();
private final FLabel lblReset = new FLabel.Builder().text("Reset").hoverable(true).opaque(true).fontSize(16).build();
private final FLabel lblAuto = new FLabel.Builder().text("Auto").hoverable(true).opaque(true).fontSize(16).build();
// TODO Add Auto and Reset Buttons and hook them up to created functions // TODO Add Auto and Reset Buttons and hook them up to created functions
@@ -245,6 +249,12 @@ public class VAssignDamage {
private final Command cmdOK = new Command() { @Override private final Command cmdOK = new Command() { @Override
public void execute() { finish(); } }; public void execute() { finish(); } };
private final Command cmdReset = new Command() { @Override
public void execute() { resetAssignDamage(); } };
private final Command cmdAuto = new Command() { @Override
public void execute() { autoAssignDamage(); } };
/** Constructor. /** Constructor.
* *
* @param attacker0 {@link forge.Card} * @param attacker0 {@link forge.Card}
@@ -327,13 +337,17 @@ public class VAssignDamage {
} }
lblOK.setCommand(cmdOK); lblOK.setCommand(cmdOK);
lblReset.setCommand(cmdReset);
lblAuto.setCommand(cmdAuto);
// Final UI layout // Final UI layout
pnlMain.setLayout(new MigLayout("insets 0, gap 0, wrap 2, ax center")); pnlMain.setLayout(new MigLayout("insets 0, gap 0, wrap 2, ax center"));
pnlMain.add(pnlAttacker, "w 125px!, h 160px!, gap 50px 0 0 15px"); pnlMain.add(pnlAttacker, "w 125px!, h 160px!, gap 50px 0 0 15px");
pnlMain.add(pnlInfo, "gap 20px 0 0 15px"); pnlMain.add(pnlInfo, "gap 20px 0 0 15px");
pnlMain.add(scrDefenders, "w 96%!, gap 2% 0 0 0, pushy, growy, ax center, span 2"); pnlMain.add(scrDefenders, "w 96%!, gap 2% 0 0 0, pushy, growy, ax center, span 2");
pnlMain.add(lblOK, "w 100px!, h 30px!, gap 0 0 5px 10px, ax center, span 2"); pnlMain.add(lblOK, "w 100px!, h 30px!, gap 0 0 5px 10px, ax center, span 2");
// TODO Align lblAuto and lblRest on same row as OK button. Auto, Ok, Reset
overlay.add(pnlMain); overlay.add(pnlMain);