race and class GUIs, pending continue button implementation into GUImanager

This commit is contained in:
Josh Ashton
2022-11-09 22:32:48 -07:00
parent 39d6470e66
commit 582c6c41bc
8 changed files with 191 additions and 368 deletions
+26 -13
View File
@@ -9,10 +9,9 @@ import java.awt.event.ActionListener;
public class ChooseRacePanel extends JPanel {
private String raceChoice;
private boolean ableToContinue;
/**
* Create the panel.
*/
public ChooseRacePanel() {
super();
@@ -38,7 +37,6 @@ public class ChooseRacePanel extends JPanel {
racesContainer.add(createButton(availableRaces[i]));
}
masterPanel.add(racesContainer);
@@ -47,24 +45,39 @@ public class ChooseRacePanel extends JPanel {
}
private JButton createButton(String raceName) {
private JButton createButton(String userChoice) {
JButton button = new JButton(raceName);
button.addActionListener(
JButton button = new JButton(userChoice);
new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
button.addActionListener(
raceChoice = raceName;
new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
System.out.println(userChoice);
raceChoice = userChoice;
ableToContinue = true;
}
}
}
);
);
return button;
}
public String getRaceChoice() {
return raceChoice;
}
public boolean isAbleToContinue() {
return ableToContinue;
}
}