guiVersion of project, rewriting code for maximum clarity
This commit is contained in:
@@ -0,0 +1,11 @@
|
||||
public class DndCharacterBuilder {
|
||||
|
||||
public static void main(String[] args) {
|
||||
|
||||
PanelHolder guiPanels = new PanelHolder();
|
||||
|
||||
UImanager gui = new UImanager(guiPanels);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,129 @@
|
||||
public static class PanelHolder {
|
||||
|
||||
private JPanel mainMenuPanel;
|
||||
private JPanel racePanel;
|
||||
private JPanel classPanel;
|
||||
private JPanel abilityScorePanel;
|
||||
private JPanel descriptionPanel;
|
||||
private JPanel equipmentPanel;
|
||||
private JPanel finalizePanel;
|
||||
private JPanel loadMenuPanel;
|
||||
|
||||
public PanelHolder() {
|
||||
|
||||
this.mainMenuPanel = createMainMenuPanel();
|
||||
this.racePanel = createRaceSelectPanel();
|
||||
this.classPanel = createClassSelectPanel();
|
||||
this.abilityScorePanel = createAbilityScoreSelectPanel();
|
||||
this.descriptionPanel = createDescriptionPanel();
|
||||
this.equipmentPanel = createEquipmentSelectPanel();
|
||||
this.finalizePanel = createFinalizePanel();
|
||||
this.loadMenuPanel = createLoadMenu();
|
||||
|
||||
}
|
||||
|
||||
public JPanel getMainMenuPanel() {
|
||||
|
||||
return mainMenuPanel;
|
||||
|
||||
}
|
||||
|
||||
public JPanel getRacePanel() {
|
||||
|
||||
return racePanel;
|
||||
|
||||
}
|
||||
|
||||
public JPanel getClassPanel() {
|
||||
|
||||
return classPanel;
|
||||
|
||||
}
|
||||
|
||||
public JPanel getAbilityScorePanel() {
|
||||
|
||||
return abilityScorePanel;
|
||||
|
||||
}
|
||||
|
||||
public JPanel getDescriptionPanel() {
|
||||
|
||||
return descriptionPanel;
|
||||
|
||||
}
|
||||
|
||||
public JPanel getEquipmentPanel() {
|
||||
|
||||
return equipmentPanel;
|
||||
|
||||
}
|
||||
|
||||
public JPanel getFinalizePanel() {
|
||||
|
||||
return finalizePanel;
|
||||
|
||||
}
|
||||
|
||||
public JPanel getLoadMenuPanel() {
|
||||
|
||||
return loadMenuPanel;
|
||||
|
||||
}
|
||||
|
||||
// TODO: Need to implement.
|
||||
private JPanel createMainMenuPanel() {
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
// TODO: Need to implement.
|
||||
private JPanel createRaceSelectPanel() {
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
// TODO: Need to implement.
|
||||
private JPanel createClassSelectPanel() {
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
// TODO: Need to implement.
|
||||
private JPanel createAbilityScoreSelectPanel() {
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
// TODO: Need to implement.
|
||||
private JPanel createDescriptionPanel() {
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
// TODO: Need to implement.
|
||||
private JPanel createEquipmentSelectPanel() {
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
// TODO: Need to implement.
|
||||
private JPanel createFinalizePanel() {
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
// TODO: Need to implement.
|
||||
private JPanel createLoadMenu() {
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,76 @@
|
||||
public class UImanager {
|
||||
|
||||
private JFrame gui;
|
||||
private PanelHolder guiPanels;
|
||||
private int currentPanel;
|
||||
|
||||
public UImanager (PanelHolder guiPanels) {
|
||||
|
||||
this.gui = new JFrame("D&D Character Builder");
|
||||
this.guiPanels = guiPanels;
|
||||
|
||||
if (returningUser()) {
|
||||
|
||||
this.currentPanel = 0;
|
||||
|
||||
} else {
|
||||
|
||||
this.currentPanel = 1;
|
||||
|
||||
}
|
||||
|
||||
frameSetup();
|
||||
|
||||
|
||||
}
|
||||
|
||||
// TODO: Need to implement.
|
||||
private void frameSetup() {
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
// TODO: Need to implement.
|
||||
private boolean returningUser() {
|
||||
|
||||
return false;
|
||||
|
||||
}
|
||||
|
||||
private JPanel getNextPanel() {
|
||||
|
||||
switch (currentPanel) {
|
||||
|
||||
case: 1
|
||||
return guiPanels.getRacePanel();
|
||||
case: 2
|
||||
return guiPanels.getClassPanel();
|
||||
case: 3
|
||||
return guiPanels.getAbilityScorePanel();
|
||||
case: 4
|
||||
return guiPanels.getDescriptionPanel();
|
||||
case: 5
|
||||
return guiPanels.getEquipmentPanel();
|
||||
case: 6
|
||||
return guiPanels.getLoadMenuPanel();
|
||||
case: 7
|
||||
return guiPanels.getFinalizePanel();
|
||||
default:
|
||||
return guiPanels.getMainMenuPanel();
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private void clearAndReset(JPanel nextPanel) {
|
||||
|
||||
gui.removeAll();
|
||||
gui.addComponent(nextPanel);
|
||||
|
||||
gui.repaint();
|
||||
gui.revalidate();
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user