Button focus adjustments for yes/no dialogs (#9828)

* UserRequestDialog buttons can't be pressed with spacebar anymore

* Pressing spacebar when drafting no longer brings up the quit menu

* Revert DraftPanel and TournamentPanel quit dialog buttons to their original positions

Co-authored-by: sprangg <a@b.c>
This commit is contained in:
sprangg 2022-12-26 18:09:41 +02:00 committed by GitHub
parent 7026811cd3
commit d604f04b79
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 8 additions and 4 deletions

View file

@ -58,16 +58,19 @@ public class UserRequestDialog extends MageDialog {
this.lblText.setText(text);
if (userRequestMessage.getButton1Text() != null) {
this.btn1.setText(userRequestMessage.getButton1Text());
this.btn1.setFocusable(false);
} else {
this.btn1.setVisible(false);
}
if (userRequestMessage.getButton2Text() != null) {
this.btn2.setText(userRequestMessage.getButton2Text());
this.btn2.setFocusable(false);
} else {
this.btn2.setVisible(false);
}
if (userRequestMessage.getButton3Text() != null) {
this.btn3.setText(userRequestMessage.getButton3Text());
this.btn3.setFocusable(false);
} else {
this.btn3.setVisible(false);
}

View file

@ -526,6 +526,7 @@
draftLeftPane.setVerifyInputWhenFocusTarget(false);
btnQuitTournament.setText("Quit Tournament");
btnQuitTournament.setFocusable(false);
btnQuitTournament.addActionListener(evt -> btnQuitTournamentActionPerformed(evt));
lblPack1.setText("Pack 1:");
@ -825,8 +826,8 @@
private void btnQuitTournamentActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnQuitTournamentActionPerformed
UserRequestMessage message = new UserRequestMessage("Confirm quit tournament", "Are you sure you want to quit the draft tournament?");
message.setButton1("Yes", PlayerAction.CLIENT_QUIT_DRAFT_TOURNAMENT);
message.setButton2("No", null);
message.setButton1("No", null);
message.setButton2("Yes", PlayerAction.CLIENT_QUIT_DRAFT_TOURNAMENT);
message.setTournamentId(draftId);
MageFrame.getInstance().showUserRequestDialog(message);
}//GEN-LAST:event_btnQuitTournamentActionPerformed

View file

@ -490,8 +490,8 @@ public class TournamentPanel extends javax.swing.JPanel {
private void btnQuitTournamentActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnQuitTournamentActionPerformed
UserRequestMessage message = new UserRequestMessage("Confirm quit tournament", "Are you sure you want to quit the tournament?");
message.setButton1("Yes", PlayerAction.CLIENT_QUIT_TOURNAMENT);
message.setButton2("No", null);
message.setButton1("No", null);
message.setButton2("Yes", PlayerAction.CLIENT_QUIT_TOURNAMENT);
message.setTournamentId(tournamentId);
MageFrame.getInstance().showUserRequestDialog(message);
}//GEN-LAST:event_btnQuitTournamentActionPerformed