mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-17 03:08:02 +00:00
Fix so Ok button in DualListBox dialog receives focus as soon as it's been enabled so spacebar will activate it
This commit is contained in:
@@ -598,7 +598,6 @@ public class PlayerControllerHuman extends PlayerController {
|
|||||||
return GuiDialog.confirm(replacementEffect.getHostCard(), question);
|
return GuiDialog.confirm(replacementEffect.getHostCard(), question);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<Card> getCardsToMulligan(boolean isCommander, Player firstPlayer) {
|
public List<Card> getCardsToMulligan(boolean isCommander, Player firstPlayer) {
|
||||||
final InputConfirmMulligan inp = new InputConfirmMulligan(player, firstPlayer, isCommander);
|
final InputConfirmMulligan inp = new InputConfirmMulligan(player, firstPlayer, isCommander);
|
||||||
@@ -715,7 +714,6 @@ public class PlayerControllerHuman extends PlayerController {
|
|||||||
return GuiDialog.confirm(sa.getSourceCard(), question, labels);
|
return GuiDialog.confirm(sa.getSourceCard(), question, labels);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean chooseFlipResult(SpellAbility sa, Player flipper, boolean[] results, boolean call) {
|
public boolean chooseFlipResult(SpellAbility sa, Player flipper, boolean[] results, boolean call) {
|
||||||
String[] labelsSrc = call ? new String[]{"heads", "tails"} : new String[]{"win the flip", "lose the flip"};
|
String[] labelsSrc = call ? new String[]{"heads", "tails"} : new String[]{"win the flip", "lose the flip"};
|
||||||
@@ -773,7 +771,6 @@ public class PlayerControllerHuman extends PlayerController {
|
|||||||
GuiDialog.message(message, sa.getSourceCard().getName());
|
GuiDialog.message(message, sa.getSourceCard().getName());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// These are not much related to PlayerController
|
// These are not much related to PlayerController
|
||||||
private String formatNotificationMessage(SpellAbility sa, GameObject target, String value) {
|
private String formatNotificationMessage(SpellAbility sa, GameObject target, String value) {
|
||||||
if (sa.getApi() == null) {
|
if (sa.getApi() == null) {
|
||||||
|
|||||||
@@ -92,6 +92,9 @@ public class DualListBox<T> extends FPanel {
|
|||||||
clearSourceSelected();
|
clearSourceSelected();
|
||||||
sourceList.validate();
|
sourceList.validate();
|
||||||
_setButtonState();
|
_setButtonState();
|
||||||
|
if (okButton.isEnabled()) {
|
||||||
|
okButton.requestFocusInWindow();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -217,7 +220,7 @@ public class DualListBox<T> extends FPanel {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void _handleListKey (KeyEvent e, Runnable onSpace, FList<T> arrowFocusTarget) {
|
private void _handleListKey(KeyEvent e, Runnable onSpace, FList<T> arrowFocusTarget) {
|
||||||
switch (e.getKeyCode()) {
|
switch (e.getKeyCode()) {
|
||||||
case KeyEvent.VK_SPACE:
|
case KeyEvent.VK_SPACE:
|
||||||
onSpace.run();
|
onSpace.run();
|
||||||
@@ -409,6 +412,7 @@ public class DualListBox<T> extends FPanel {
|
|||||||
addDestinationElements(sourceListModel);
|
addDestinationElements(sourceListModel);
|
||||||
clearSourceListModel();
|
clearSourceListModel();
|
||||||
_setButtonState();
|
_setButtonState();
|
||||||
|
okButton.requestFocusInWindow();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void _removeAll() {
|
private void _removeAll() {
|
||||||
|
|||||||
Reference in New Issue
Block a user