debugging
This commit is contained in:
Generated
+8
@@ -0,0 +1,8 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project version="4">
|
||||||
|
<component name="CompilerConfiguration">
|
||||||
|
<excludeFromCompile>
|
||||||
|
<file url="file://$PROJECT_DIR$/dndBuilder/src/Character/Skills.java" />
|
||||||
|
</excludeFromCompile>
|
||||||
|
</component>
|
||||||
|
</project>
|
||||||
Generated
+3
-1
@@ -1,4 +1,6 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<project version="4">
|
<project version="4">
|
||||||
<component name="ProjectRootManager" version="2" languageLevel="JDK_17" default="true" project-jdk-name="17" project-jdk-type="JavaSDK" />
|
<component name="ProjectRootManager" version="2" languageLevel="JDK_17" default="true" project-jdk-name="17" project-jdk-type="JavaSDK">
|
||||||
|
<output url="file://$USER_HOME$/Desktop/dndApp" />
|
||||||
|
</component>
|
||||||
</project>
|
</project>
|
||||||
+5
-4
@@ -1,4 +1,5 @@
|
|||||||
package Character;
|
package Character.AbilityScores;
|
||||||
|
|
||||||
public class CharacterStats {
|
public class CharacterStats {
|
||||||
|
|
||||||
private Stats[] stats;
|
private Stats[] stats;
|
||||||
@@ -48,13 +49,13 @@ public class CharacterStats {
|
|||||||
*
|
*
|
||||||
* Allows for access to a particular stat.
|
* Allows for access to a particular stat.
|
||||||
*
|
*
|
||||||
* @param int stat
|
* @param index
|
||||||
* @return a specific stat
|
* @return a specific stat
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public Stats getStats(int stat) {
|
public Stats getStats(int index) {
|
||||||
|
|
||||||
return stats[stat];
|
return stats[index];
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -46,7 +46,7 @@ public class Charisma extends Stats {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
void increaseScore() {
|
public void increaseScore() {
|
||||||
|
|
||||||
abilityScore++;
|
abilityScore++;
|
||||||
|
|
||||||
|
|||||||
@@ -46,7 +46,7 @@ public class Constitution extends Stats {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
void increaseScore() {
|
public void increaseScore() {
|
||||||
|
|
||||||
abilityScore++;
|
abilityScore++;
|
||||||
|
|
||||||
|
|||||||
@@ -46,7 +46,7 @@ public class Dexterity extends Stats {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
void increaseScore() {
|
public void increaseScore() {
|
||||||
|
|
||||||
abilityScore++;
|
abilityScore++;
|
||||||
|
|
||||||
|
|||||||
@@ -46,7 +46,7 @@ public class Intelligence extends Stats{
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
void increaseScore() {
|
public void increaseScore() {
|
||||||
|
|
||||||
abilityScore++;
|
abilityScore++;
|
||||||
|
|
||||||
|
|||||||
@@ -37,13 +37,13 @@ public abstract class Stats {
|
|||||||
case 20:
|
case 20:
|
||||||
return 5;
|
return 5;
|
||||||
default:
|
default:
|
||||||
return 0;
|
return -42;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
abstract void increaseScore();
|
public abstract void increaseScore();
|
||||||
|
|
||||||
abstract int getScore();
|
abstract int getScore();
|
||||||
|
|
||||||
|
|||||||
@@ -58,7 +58,7 @@ public class Strength extends Stats {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
void increaseScore() {
|
public void increaseScore() {
|
||||||
|
|
||||||
abilityScore++;
|
abilityScore++;
|
||||||
|
|
||||||
|
|||||||
@@ -46,7 +46,7 @@ public class Wisdom extends Stats {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
void increaseScore() {
|
public void increaseScore() {
|
||||||
|
|
||||||
abilityScore++;
|
abilityScore++;
|
||||||
|
|
||||||
|
|||||||
@@ -13,7 +13,6 @@ public class Background {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* @param name
|
* @param name
|
||||||
* @param skillProficiences
|
|
||||||
* @param feature
|
* @param feature
|
||||||
*/
|
*/
|
||||||
public Background(String name, boolean[] proficientStatus, String[] skills, String feature) {
|
public Background(String name, boolean[] proficientStatus, String[] skills, String feature) {
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
package Character;
|
package Character;
|
||||||
|
|
||||||
|
import Character.AbilityScores.CharacterStats;
|
||||||
import Character.Races.*;
|
import Character.Races.*;
|
||||||
|
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
|
|||||||
@@ -1,5 +1,7 @@
|
|||||||
package Character;
|
package Character;
|
||||||
|
|
||||||
|
import Character.AbilityScores.*;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* Object stores information about a character's skills arrays. Firstly, the name of each skill, and secondly the value of each skill. When constructed, a private method is called
|
* Object stores information about a character's skills arrays. Firstly, the name of each skill, and secondly the value of each skill. When constructed, a private method is called
|
||||||
@@ -23,8 +25,8 @@ public class Skills {
|
|||||||
*
|
*
|
||||||
* Default constructor for the Skills class. Should be constructed AFTER the user has generated their stats and chosen the skills they are proficient in.
|
* Default constructor for the Skills class. Should be constructed AFTER the user has generated their stats and chosen the skills they are proficient in.
|
||||||
*
|
*
|
||||||
* @param int[] skills
|
* @param skills
|
||||||
* @param Stats[] stats
|
* @param stats
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public Skills(int[] skills, Stats[] stats) {
|
public Skills(int[] skills, Stats[] stats) {
|
||||||
|
|||||||
@@ -5,10 +5,12 @@ public class DndCharacterBuilder {
|
|||||||
|
|
||||||
public static void main(String[] args) {
|
public static void main(String[] args) {
|
||||||
|
|
||||||
FileManager data = new FileManager();
|
//FileManager data = new FileManager();
|
||||||
|
|
||||||
PanelHolder guiPanels = new PanelHolder();
|
PanelHolder guiPanels = new PanelHolder();
|
||||||
UImanager gui = new UImanager(guiPanels, data.isReturninguser());
|
// UImanager gui = new UImanager(guiPanels, data.isReturninguser());
|
||||||
|
UImanager gui = new UImanager(guiPanels);
|
||||||
|
gui.setVisible(true);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
package FileManagement;
|
package FileManagement;
|
||||||
|
|
||||||
import java.io.*;
|
import java.io.*;
|
||||||
|
import java.util.Arrays;
|
||||||
|
|
||||||
import Character.*;
|
import Character.*;
|
||||||
|
|
||||||
@@ -10,12 +11,20 @@ public class FileManager {
|
|||||||
|
|
||||||
public FileManager() {
|
public FileManager() {
|
||||||
|
|
||||||
|
System.out.println("FileManager object created.\n");
|
||||||
|
|
||||||
findSavedCharacters();
|
findSavedCharacters();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isReturninguser() {
|
public boolean isReturninguser() {
|
||||||
|
|
||||||
|
if(savedCharacters == null) {
|
||||||
|
|
||||||
|
return false;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
return savedCharacters.length > 0;
|
return savedCharacters.length > 0;
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -64,6 +73,8 @@ public class FileManager {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
findSavedCharacters();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void deleteCharacter(int index) {
|
public void deleteCharacter(int index) {
|
||||||
@@ -82,12 +93,13 @@ public class FileManager {
|
|||||||
|
|
||||||
savedCharacters = tmp;
|
savedCharacters = tmp;
|
||||||
|
|
||||||
|
findSavedCharacters();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: Need to implement. Should create an array of Files corresponding to user-created characters.
|
|
||||||
private void findSavedCharacters() {
|
private void findSavedCharacters() {
|
||||||
|
|
||||||
savedCharacters = new File("/bin/").listFiles();
|
savedCharacters = new File("/dndBuilder").listFiles();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,9 @@
|
|||||||
package GUI;
|
package GUI;
|
||||||
|
|
||||||
|
import GUI.Panels.ChooseRacePanel;
|
||||||
|
|
||||||
import javax.swing.*;
|
import javax.swing.*;
|
||||||
|
import java.awt.*;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
||||||
@@ -15,40 +18,44 @@ NOTES:
|
|||||||
|
|
||||||
public class PanelHolder {
|
public class PanelHolder {
|
||||||
|
|
||||||
|
/*
|
||||||
private JPanel mainMenuPanel;
|
private JPanel mainMenuPanel;
|
||||||
|
*/
|
||||||
private JPanel racePanel;
|
private JPanel racePanel;
|
||||||
private JPanel classPanel;
|
/* private JPanel classPanel;
|
||||||
private JPanel abilityScorePanel;
|
private JPanel abilityScorePanel;
|
||||||
private JPanel descriptionPanel;
|
private JPanel descriptionPanel;
|
||||||
private JPanel equipmentPanel;
|
private JPanel equipmentPanel;
|
||||||
private JPanel finalizePanel;
|
private JPanel finalizePanel;
|
||||||
private JPanel loadMenuPanel;
|
private JPanel loadMenuPanel;*/
|
||||||
|
|
||||||
private int lastPanel;
|
// private int lastPanel;
|
||||||
private int currentPanel;
|
private int currentPanel;
|
||||||
private int nextPanel;
|
// private int nextPanel;
|
||||||
|
|
||||||
public PanelHolder() {
|
public PanelHolder() {
|
||||||
|
|
||||||
|
/*
|
||||||
this.mainMenuPanel = createMainMenuPanel();
|
this.mainMenuPanel = createMainMenuPanel();
|
||||||
|
*/
|
||||||
this.racePanel = createRaceSelectPanel();
|
this.racePanel = createRaceSelectPanel();
|
||||||
this.classPanel = createClassSelectPanel();
|
/* this.classPanel = createClassSelectPanel();
|
||||||
this.abilityScorePanel = createAbilityScoreSelectPanel();
|
this.abilityScorePanel = createAbilityScoreSelectPanel();
|
||||||
this.descriptionPanel = createDescriptionPanel();
|
this.descriptionPanel = createDescriptionPanel();
|
||||||
this.equipmentPanel = createEquipmentSelectPanel();
|
this.equipmentPanel = createEquipmentSelectPanel();
|
||||||
this.finalizePanel = createFinalizePanel();
|
this.finalizePanel = createFinalizePanel();
|
||||||
this.loadMenuPanel = createLoadMenu();
|
this.loadMenuPanel = createLoadMenu();*/
|
||||||
lastPanel = 0;
|
// lastPanel = 0;
|
||||||
currentPanel = 0;
|
currentPanel = 0;
|
||||||
nextPanel = 0;
|
// nextPanel = 0;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public JPanel getMainMenuPanel() {
|
/* public JPanel getMainMenuPanel() {
|
||||||
|
|
||||||
return mainMenuPanel;
|
return mainMenuPanel;
|
||||||
|
|
||||||
}
|
}*/
|
||||||
|
|
||||||
public JPanel getRacePanel() {
|
public JPanel getRacePanel() {
|
||||||
|
|
||||||
@@ -56,7 +63,7 @@ public class PanelHolder {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public JPanel getClassPanel() {
|
/* public JPanel getClassPanel() {
|
||||||
|
|
||||||
return classPanel;
|
return classPanel;
|
||||||
|
|
||||||
@@ -92,19 +99,19 @@ public class PanelHolder {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* TODO: Need to implement.
|
*//* TODO: Need to implement.
|
||||||
|
|
||||||
LEFT-SIDE: Two large buttons, split with a horizontal line. One is to create a new DnD character, the other is to create a
|
LEFT-SIDE: Two large buttons, split with a horizontal line. One is to create a new DnD character, the other is to create a
|
||||||
random character.
|
random character.
|
||||||
|
|
||||||
RIGHT-SIDE: One extra-large button to load an existing character.
|
RIGHT-SIDE: One extra-large button to load an existing character.
|
||||||
|
|
||||||
*/
|
*//*
|
||||||
private JPanel createMainMenuPanel() {
|
private JPanel createMainMenuPanel() {
|
||||||
|
|
||||||
return new JPanel();
|
return new JPanel();
|
||||||
|
|
||||||
}
|
}*/
|
||||||
|
|
||||||
/* TODO: Need to implement.
|
/* TODO: Need to implement.
|
||||||
|
|
||||||
@@ -117,14 +124,68 @@ public class PanelHolder {
|
|||||||
*/
|
*/
|
||||||
private JPanel createRaceSelectPanel() {
|
private JPanel createRaceSelectPanel() {
|
||||||
|
|
||||||
currentPanel++;
|
System.out.println("Race Panel generated.");
|
||||||
|
|
||||||
|
JPanel display = new JPanel();
|
||||||
|
display.setLayout(new BorderLayout(0, 0));
|
||||||
|
|
||||||
|
|
||||||
|
JLabel title = new JLabel("Step 1: Choose Race");
|
||||||
|
title.setHorizontalAlignment(SwingConstants.CENTER);
|
||||||
|
display.add(title, BorderLayout.NORTH);
|
||||||
|
|
||||||
|
JPanel textPanel = new JPanel();
|
||||||
|
textPanel.setLayout(null);
|
||||||
|
|
||||||
|
JLabel characterName = new JLabel("Character Name: ");
|
||||||
|
characterName.setBounds(113, 31, 108, 16);
|
||||||
|
textPanel.add(characterName);
|
||||||
|
|
||||||
|
JTextField nameTextBox = new JTextField();
|
||||||
|
nameTextBox.setBounds(233, 26, 211, 26);
|
||||||
|
textPanel.add(nameTextBox);
|
||||||
|
nameTextBox.setColumns(10);
|
||||||
|
|
||||||
|
JLabel raceLbl = new JLabel("Choose Race: ");
|
||||||
|
raceLbl.setBounds(113, 70, 98, 16);
|
||||||
|
textPanel.add(raceLbl);
|
||||||
|
|
||||||
|
JComboBox raceComboBox = new JComboBox();
|
||||||
|
raceComboBox.setBounds(196, 54, 221, 50);
|
||||||
|
textPanel.add(raceComboBox);
|
||||||
|
|
||||||
|
JLabel genderLbl = new JLabel("Gender: ");
|
||||||
|
genderLbl.setBounds(113, 108, 61, 16);
|
||||||
|
textPanel.add(genderLbl);
|
||||||
|
|
||||||
|
JComboBox genderComboBox = new JComboBox();
|
||||||
|
genderComboBox.setBounds(162, 92, 211, 50);
|
||||||
|
textPanel.add(genderComboBox);
|
||||||
|
|
||||||
|
JLabel classLbl = new JLabel("Class: ");
|
||||||
|
classLbl.setBounds(113, 154, 61, 16);
|
||||||
|
textPanel.add(classLbl);
|
||||||
|
|
||||||
|
JComboBox classComboBox = new JComboBox();
|
||||||
|
classComboBox.setBounds(162, 138, 200, 50);
|
||||||
|
textPanel.add(classComboBox);
|
||||||
|
|
||||||
|
JLabel AlignmentLbl = new JLabel("Alignment: ");
|
||||||
|
AlignmentLbl.setBounds(113, 200, 80, 16);
|
||||||
|
textPanel.add(AlignmentLbl);
|
||||||
|
|
||||||
|
JComboBox comboBox = new JComboBox();
|
||||||
|
comboBox.setBounds(190, 184, 200, 50);
|
||||||
|
textPanel.add(comboBox);
|
||||||
|
|
||||||
|
display.add(textPanel, BorderLayout.CENTER);
|
||||||
|
|
||||||
return new JPanel();
|
return new JPanel();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: Need to implement.
|
// TODO: Need to implement.
|
||||||
private JPanel createClassSelectPanel() {
|
/* private JPanel createClassSelectPanel() {
|
||||||
|
|
||||||
currentPanel++;
|
currentPanel++;
|
||||||
|
|
||||||
@@ -176,5 +237,5 @@ public class PanelHolder {
|
|||||||
return new JPanel();
|
return new JPanel();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
}
|
}
|
||||||
@@ -0,0 +1,28 @@
|
|||||||
|
package GUI.Panels;
|
||||||
|
|
||||||
|
import javax.swing.JPanel;
|
||||||
|
import java.awt.BorderLayout;
|
||||||
|
import javax.swing.JLabel;
|
||||||
|
import javax.swing.SwingConstants;
|
||||||
|
import javax.swing.JTextField;
|
||||||
|
import javax.swing.JComboBox;
|
||||||
|
import java.awt.GridLayout;
|
||||||
|
|
||||||
|
public class ChooseRacePanel extends JPanel {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Create the panel.
|
||||||
|
*/
|
||||||
|
public ChooseRacePanel() {
|
||||||
|
|
||||||
|
createPanel();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
private void createPanel() {
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,49 @@
|
|||||||
|
package GUI.Panels;
|
||||||
|
|
||||||
|
import java.awt.BorderLayout;
|
||||||
|
import java.awt.EventQueue;
|
||||||
|
|
||||||
|
import javax.swing.JFrame;
|
||||||
|
import javax.swing.JPanel;
|
||||||
|
import javax.swing.border.EmptyBorder;
|
||||||
|
import javax.swing.JButton;
|
||||||
|
|
||||||
|
public class GuiCharacterFrame extends JFrame {
|
||||||
|
|
||||||
|
private JPanel contentPane;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Launch the application.
|
||||||
|
*/
|
||||||
|
/* public static void main(String[] args) {
|
||||||
|
EventQueue.invokeLater(new Runnable() {
|
||||||
|
public void run() {
|
||||||
|
try {
|
||||||
|
GuiCharacterFrame frame = new GuiCharacterFrame();
|
||||||
|
frame.setVisible(true);
|
||||||
|
} catch (Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Create the frame.
|
||||||
|
*/
|
||||||
|
/* public GuiCharacterFrame() {
|
||||||
|
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
|
||||||
|
setBounds(100, 100, 550, 300);
|
||||||
|
contentPane = new JPanel();
|
||||||
|
contentPane.setBorder(new EmptyBorder(5, 5, 5, 5));
|
||||||
|
contentPane.setLayout(new BorderLayout(0, 0));
|
||||||
|
setContentPane(contentPane);
|
||||||
|
|
||||||
|
ChooseRacePanel panel = new ChooseRacePanel();
|
||||||
|
contentPane.add(panel, BorderLayout.CENTER);
|
||||||
|
|
||||||
|
JButton submitBttn = new JButton("Next");
|
||||||
|
panel.add(submitBttn, BorderLayout.SOUTH);
|
||||||
|
}*/
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,96 @@
|
|||||||
|
package GUI.Panels;
|
||||||
|
|
||||||
|
import java.awt.BorderLayout;
|
||||||
|
import java.awt.EventQueue;
|
||||||
|
|
||||||
|
import javax.swing.JFrame;
|
||||||
|
import javax.swing.JPanel;
|
||||||
|
import javax.swing.border.EmptyBorder;
|
||||||
|
import java.awt.Color;
|
||||||
|
import java.awt.GridBagLayout;
|
||||||
|
import java.awt.GridBagConstraints;
|
||||||
|
import javax.swing.JLabel;
|
||||||
|
import javax.swing.JTextField;
|
||||||
|
import java.awt.Insets;
|
||||||
|
import java.awt.FlowLayout;
|
||||||
|
import javax.swing.BoxLayout;
|
||||||
|
import javax.swing.ImageIcon;
|
||||||
|
|
||||||
|
import java.awt.GridLayout;
|
||||||
|
import java.awt.ScrollPane;
|
||||||
|
import java.awt.Scrollbar;
|
||||||
|
import javax.swing.JScrollPane;
|
||||||
|
import javax.swing.ScrollPaneConstants;
|
||||||
|
import javax.swing.JScrollBar;
|
||||||
|
|
||||||
|
public class dndCharacterSheet extends JFrame {
|
||||||
|
|
||||||
|
private JPanel contentPane;
|
||||||
|
private JTextField textField;
|
||||||
|
private JPanel panel;
|
||||||
|
private JTextField textField_1;
|
||||||
|
private JTextField textField_2;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Launch the application.
|
||||||
|
*/
|
||||||
|
/* public static void main(String[] args) {
|
||||||
|
EventQueue.invokeLater(new Runnable() {
|
||||||
|
public void run() {
|
||||||
|
try {
|
||||||
|
dndCharacterSheet frame = new dndCharacterSheet();
|
||||||
|
frame.setVisible(true);
|
||||||
|
} catch (Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Create the frame.
|
||||||
|
*/
|
||||||
|
public dndCharacterSheet() {
|
||||||
|
|
||||||
|
JLabel imageLabel = new JLabel(new ImageIcon(getClass().getResource("/dnd/img/sheet.jpg")));
|
||||||
|
JPanel newPanel = new JPanel();
|
||||||
|
newPanel.add(imageLabel);
|
||||||
|
JScrollPane scrollPane = new JScrollPane(newPanel);
|
||||||
|
|
||||||
|
|
||||||
|
this.getContentPane().add(scrollPane, BorderLayout.CENTER);
|
||||||
|
|
||||||
|
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
|
||||||
|
setBounds(100, 100, 850, 1200);
|
||||||
|
setVisible(true);
|
||||||
|
pack();
|
||||||
|
|
||||||
|
// contentPane = new JPanel();
|
||||||
|
// contentPane.setBorder(new EmptyBorder(5, 5, 5, 5));
|
||||||
|
// setContentPane(contentPane);
|
||||||
|
// contentPane.setLayout(new BorderLayout(0, 0));
|
||||||
|
|
||||||
|
/*ImagePanel imagePanel = new ImagePanel();
|
||||||
|
JScrollPane scrollPane = new JScrollPane();
|
||||||
|
|
||||||
|
JPanel panel1 = new JPanel();
|
||||||
|
panel1.setLayout(new BorderLayout(0, 0));
|
||||||
|
panel1.add(imagePanel, BorderLayout.CENTER);
|
||||||
|
scrollPane.add(panel1);
|
||||||
|
imagePanel.setLayout(null);
|
||||||
|
|
||||||
|
|
||||||
|
contentPane.add(scrollPane, BorderLayout.CENTER);*/
|
||||||
|
|
||||||
|
// ImagePanel imagePanel = new ImagePanel();
|
||||||
|
// contentPane.add(imagePanel, BorderLayout.CENTER);
|
||||||
|
// imagePanel.setLayout(null);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
Binary file not shown.
|
After Width: | Height: | Size: 111 KiB |
@@ -1,19 +1,20 @@
|
|||||||
package GUI;
|
package GUI;
|
||||||
|
|
||||||
import javax.swing.*;
|
import javax.swing.*;
|
||||||
|
import java.awt.*;
|
||||||
|
|
||||||
public class UImanager {
|
public class UImanager extends JFrame {
|
||||||
|
|
||||||
private final JFrame gui;
|
|
||||||
private final PanelHolder guiPanels;
|
private final PanelHolder guiPanels;
|
||||||
private int currentPanel;
|
private int currentPanel;
|
||||||
|
|
||||||
public UImanager (PanelHolder guiPanels, boolean returningUser) {
|
//public UImanager (PanelHolder guiPanels, boolean returningUser) {
|
||||||
|
public UImanager (PanelHolder guiPanels) {
|
||||||
this.gui = new JFrame("D&D Character Builder");
|
super("D&D Character Builder");
|
||||||
|
frameSetup();
|
||||||
this.guiPanels = guiPanels;
|
this.guiPanels = guiPanels;
|
||||||
|
|
||||||
if (returningUser) {
|
/* if (returningUser) {
|
||||||
|
|
||||||
this.currentPanel = 0;
|
this.currentPanel = 0;
|
||||||
|
|
||||||
@@ -21,22 +22,33 @@ public class UImanager {
|
|||||||
|
|
||||||
this.currentPanel = 1;
|
this.currentPanel = 1;
|
||||||
|
|
||||||
}
|
}*/
|
||||||
|
|
||||||
frameSetup();
|
clearAndReset(getNextPanel());
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: Need to implement.
|
// TODO: Need to implement.
|
||||||
private void frameSetup() {
|
private void frameSetup() {
|
||||||
|
|
||||||
|
setDefaultCloseOperation(EXIT_ON_CLOSE);
|
||||||
|
setLayout(new BorderLayout());
|
||||||
|
setPreferredSize(new Dimension(600,600));
|
||||||
|
setSize(getPreferredSize());
|
||||||
|
|
||||||
|
try {
|
||||||
|
UIManager.setLookAndFeel( UIManager.getCrossPlatformLookAndFeelClassName() );
|
||||||
|
} catch (Exception e) {
|
||||||
|
System.out.println("Error with cross platform look/feel in frameSetup().");
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private JPanel getNextPanel() {
|
private JPanel getNextPanel() {
|
||||||
|
|
||||||
return switch (currentPanel) {
|
return guiPanels.getRacePanel();
|
||||||
|
|
||||||
|
/* return switch (currentPanel) {
|
||||||
case 1 -> guiPanels.getRacePanel();
|
case 1 -> guiPanels.getRacePanel();
|
||||||
case 2 -> guiPanels.getClassPanel();
|
case 2 -> guiPanels.getClassPanel();
|
||||||
case 3 -> guiPanels.getAbilityScorePanel();
|
case 3 -> guiPanels.getAbilityScorePanel();
|
||||||
@@ -45,17 +57,17 @@ public class UImanager {
|
|||||||
case 6 -> guiPanels.getLoadMenuPanel();
|
case 6 -> guiPanels.getLoadMenuPanel();
|
||||||
case 7 -> guiPanels.getFinalizePanel();
|
case 7 -> guiPanels.getFinalizePanel();
|
||||||
default -> guiPanels.getMainMenuPanel();
|
default -> guiPanels.getMainMenuPanel();
|
||||||
};
|
};*/
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void clearAndReset(JPanel nextPanel) {
|
private void clearAndReset(JPanel nextPanel) {
|
||||||
|
|
||||||
gui.removeAll();
|
removeAll();
|
||||||
gui.add(nextPanel);
|
add(nextPanel);
|
||||||
|
|
||||||
gui.repaint();
|
repaint();
|
||||||
gui.revalidate();
|
revalidate();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user