diff --git a/src/App.class b/src/App.class new file mode 100644 index 0000000..5a19e0a Binary files /dev/null and b/src/App.class differ diff --git a/src/AppConstants.class b/src/AppConstants.class new file mode 100644 index 0000000..1fa2222 Binary files /dev/null and b/src/AppConstants.class differ diff --git a/src/AppConstants.java b/src/AppConstants.java new file mode 100644 index 0000000..2c1924f --- /dev/null +++ b/src/AppConstants.java @@ -0,0 +1,37 @@ +package src; + +import java.awt.*; + +public final class AppConstants { + + private AppConstants() {} + +// CONSTANTS FOR FILE MANAGEMENT. + + public static final String OS = System.getProperty("os.name"); + + public static final String mainFilepath = System.getProperty("user.dir"); + + public static final String imgFilepath = System.getProperty("user.dir") + "/.resources/img/"; + + public static final String fontFilepath = System.getProperty("user.dir") + "/.resources/SanSalvi.ttf"; + + public static final String savesFilepath = System.getProperty("user.dir") + "/.savedSheets/"; + + + +// CONSTANTS FOR THEME. + + public static final Color lightAccent = Color.decode("#EAF0CE"); + public static final Color lightBrown = Color.decode("#EBBE9B"); + public static final Color medBrown = Color.decode("#E4A677"); + public static final Color darkBrown = Color.decode("#502419"); + public static final Color darkestBrown = Color.decode("#1F0E0A"); + public static final Color black = Color.BLACK; + public static final Font headerFont = new Font("SanSalvi", Font.BOLD, 45); + public static final Font subHeaderFont = new Font("SanSalvi", Font.PLAIN, 35); + public static final Font paragraphText = new Font("SanSalvi", Font.PLAIN, 20); + public static final Font userText = new Font("SanSalvi", Font.PLAIN, 15); + public static final Font buttonFont = new Font("SanSalvi", Font.PLAIN, 15); + +} diff --git a/src/Background.class b/src/Background.class new file mode 100644 index 0000000..1e9ab69 Binary files /dev/null and b/src/Background.class differ diff --git a/src/BasicNavPanel.class b/src/BasicNavPanel.class new file mode 100644 index 0000000..1de75ed Binary files /dev/null and b/src/BasicNavPanel.class differ diff --git a/src/BasicPanel.class b/src/BasicPanel.class new file mode 100644 index 0000000..2c27eab Binary files /dev/null and b/src/BasicPanel.class differ diff --git a/src/BasicPanel.java b/src/BasicPanel.java index e8dd36c..ebfb50d 100644 --- a/src/BasicPanel.java +++ b/src/BasicPanel.java @@ -16,7 +16,7 @@ public class BasicPanel extends JPanel { private ImageManager images; private int currentPanel; - public BasicPanel(JPanel navPanel, String[] options, String[] descriptions, String panelTitle) { + public BasicPanel(JPanel navPanel, String[] options, String[] descriptions, String panelTitle, ImageManager images) { super(); this.options = options; @@ -31,18 +31,20 @@ public class BasicPanel extends JPanel { }; - images = new ImageManager(); + this.images = images; infoPanel = new InfoPanel(options, descriptions, basicBounds, images); currentPanel = Integer.parseInt(Character.toString(panelTitle.charAt(5))); - infoPanel.updateInfo(0, getNextPortrait(0)); + System.out.println("CurrentPanel: " + currentPanel); choiceIndex = 0; panelSetup(); createMasterPanel(); + + infoPanel.updateInfo(choiceIndex, getNextPortrait(choiceIndex)); add(navPanel, BorderLayout.SOUTH); } @@ -54,13 +56,13 @@ public class BasicPanel extends JPanel { if(currentPanel == 1) { nextPortrait = images.getRacePortrait(index); - +System.out.println("next portrait for race."); } else if(currentPanel == 2) { nextPortrait = images.getClassPortrait(index); - +System.out.println("next portrait for class."); } else { - +System.out.println("Returning null."); nextPortrait = null; } @@ -79,16 +81,16 @@ public class BasicPanel extends JPanel { private void createMasterPanel() { JLabel title = new JLabel(panelTitle); - title.setHorizontalAlignment(SwingConstants.CENTER); - title.setFont(headerFont); - title.setForeground(darkestBrown); + title.setHorizontalAlignment(SwingConstants.CENTER); + title.setFont(headerFont); + title.setForeground(darkestBrown); add(title, BorderLayout.NORTH); JPanel panel = new JPanel(); - panel.setOpaque(false); - panel.setLayout(null); - panel.add(infoPanel); - panel.add(createButtonPanel()); + panel.setOpaque(false); + panel.setLayout(null); + panel.add(infoPanel); + panel.add(createButtonPanel()); add(panel); @@ -130,7 +132,9 @@ public class BasicPanel extends JPanel { private DefaultButton createButton(String holderName, int index) { DefaultButton button = new DefaultButton(holderName); - button.addActionListener(e -> updateButtons(index)); + button.addActionListener(e -> { + updateButtons(index); + }); return button; @@ -149,6 +153,8 @@ public class BasicPanel extends JPanel { } else { +System.out.println("No image chosen."); + infoPanel.updateInfo(choiceIndex); } diff --git a/src/CharacterSheet.class b/src/CharacterSheet.class new file mode 100644 index 0000000..792da58 Binary files /dev/null and b/src/CharacterSheet.class differ diff --git a/src/CharacterSheet.java b/src/CharacterSheet.java index aa75cd9..02eacb9 100644 --- a/src/CharacterSheet.java +++ b/src/CharacterSheet.java @@ -30,6 +30,8 @@ public class CharacterSheet implements Serializable { * */ + + public CharacterSheet( String name, diff --git a/src/CharacterStats.class b/src/CharacterStats.class new file mode 100644 index 0000000..d3a0ca9 Binary files /dev/null and b/src/CharacterStats.class differ diff --git a/src/Charisma.class b/src/Charisma.class new file mode 100644 index 0000000..d42bace Binary files /dev/null and b/src/Charisma.class differ diff --git a/src/ChooseAbilityScoresPanel.class b/src/ChooseAbilityScoresPanel.class new file mode 100644 index 0000000..08d0e56 Binary files /dev/null and b/src/ChooseAbilityScoresPanel.class differ diff --git a/src/ClassTemplate.class b/src/ClassTemplate.class new file mode 100644 index 0000000..929ca7f Binary files /dev/null and b/src/ClassTemplate.class differ diff --git a/src/Cleric.class b/src/Cleric.class new file mode 100644 index 0000000..1682827 Binary files /dev/null and b/src/Cleric.class differ diff --git a/src/Constitution.class b/src/Constitution.class new file mode 100644 index 0000000..4b2f62f Binary files /dev/null and b/src/Constitution.class differ diff --git a/src/DefaultButton$1.class b/src/DefaultButton$1.class new file mode 100644 index 0000000..f7866a0 Binary files /dev/null and b/src/DefaultButton$1.class differ diff --git a/src/DefaultButton.class b/src/DefaultButton.class new file mode 100644 index 0000000..c06735a Binary files /dev/null and b/src/DefaultButton.class differ diff --git a/src/DescriptionPanel.class b/src/DescriptionPanel.class new file mode 100644 index 0000000..f498f5d Binary files /dev/null and b/src/DescriptionPanel.class differ diff --git a/src/DescriptionPanel.java b/src/DescriptionPanel.java index 9096133..8534a6e 100644 --- a/src/DescriptionPanel.java +++ b/src/DescriptionPanel.java @@ -1,8 +1,7 @@ package src; import javax.swing.*; -import javax.swing.border.EmptyBorder; -import javax.swing.border.LineBorder; +import javax.swing.border.*; import java.awt.*; import static src.AppConstants.*; @@ -97,10 +96,10 @@ public class DescriptionPanel extends JPanel { private JLabel createPanelTitle(String panelTitle) { JLabel title = new JLabel(panelTitle); - title.setHorizontalAlignment(SwingConstants.CENTER); - title.setFont(headerFont); - title.setForeground(darkestBrown); - title.setBorder(new EmptyBorder(25, 25, 25, 25)); + title.setHorizontalAlignment(SwingConstants.CENTER); + title.setFont(headerFont); + title.setForeground(darkestBrown); + title.setBorder(new EmptyBorder(25, 25, 25, 25)); return title; @@ -108,13 +107,11 @@ public class DescriptionPanel extends JPanel { private JPanel createBodyPanel() { - GridBagConstraints c = new GridBagConstraints(); - JPanel bodyPanel = new JPanel(new GridBagLayout()); - bodyPanel.setOpaque(false); + bodyPanel.setOpaque(false); - bodyPanel.add(createNamePanel()); - bodyPanel.add(createFooterPanel()); + bodyPanel.add(createNamePanel()); + bodyPanel.add(createFooterPanel()); return bodyPanel; @@ -123,13 +120,14 @@ public class DescriptionPanel extends JPanel { private JPanel createNamePanel() { JPanel panel = new JPanel(); - panel.setBackground(medBrown); - for (int i = 0; i < characteristicsHolder.length; i++) { + panel.setBackground(medBrown); - panel.add(createField(i)); + for (int i = 0; i < characteristicsHolder.length; i++) { - } + panel.add(createField(i)); + + } return panel; @@ -138,20 +136,23 @@ public class DescriptionPanel extends JPanel { private JPanel createField(int index) { JPanel panel = new JPanel(); - panel.setOpaque(false); - JLabel label = new JLabel(characteristicsHolder[index]); - label.setFont(paragraphText); - label.setOpaque(false); - label.setForeground(darkestBrown); + panel.setOpaque(false); - JTextField field = new JTextField(10); - field.setFont(paragraphText); - field.setBackground(lightBrown); - field.setBorder(null); + JLabel label = new JLabel(characteristicsHolder[index]); - panel.add(label); - panel.add(field); + label.setFont(paragraphText); + label.setOpaque(false); + label.setForeground(darkestBrown); + + JTextField field = new JTextField(10); + + field.setFont(paragraphText); + field.setBackground(lightBrown); + field.setBorder(null); + + panel.add(label); + panel.add(field); return panel; @@ -160,10 +161,11 @@ public class DescriptionPanel extends JPanel { private JPanel createFooterPanel() { JPanel panel = new JPanel(new GridLayout(1, 3)); - panel.setOpaque(false); - panel.add(createSubPanel("Alignment")); - panel.add(createSubPanel("Background")); - panel.add(createTextBoxPanel()); + + panel.setOpaque(false); + panel.add(createSubPanel("Alignment")); + panel.add(createSubPanel("Background")); + panel.add(createTextBoxPanel()); return panel; @@ -172,6 +174,7 @@ public class DescriptionPanel extends JPanel { private JPanel createSubPanel(String labelName) { JPanel panel = new JPanel(new BorderLayout(0, 0)); + panel.setBorder(new EmptyBorder(5, 5, 5, 5)); panel.setOpaque(false); @@ -220,18 +223,18 @@ public class DescriptionPanel extends JPanel { private JPanel createTextBoxPanel() { JPanel panel = new JPanel(new BorderLayout(0, 0)); - panel.setOpaque(false); + panel.setOpaque(false); - JLabel label = new JLabel("Enter a Description"); - label.setFont(paragraphText); - label.setOpaque(false); - label.setForeground(darkestBrown); + JLabel label = new JLabel("Enter a Description"); + label.setFont(paragraphText); + label.setOpaque(false); + label.setForeground(darkestBrown); - JTextArea textArea = new JTextArea(); - textArea.setForeground(darkestBrown); - textArea.setFont(userText); - textArea.setOpaque(false); - textArea.setBorder(new LineBorder(darkestBrown, 3)); + JTextArea textArea = new JTextArea(); + textArea.setForeground(darkestBrown); + textArea.setFont(userText); + textArea.setOpaque(false); + textArea.setBorder(new LineBorder(darkestBrown, 3)); panel.add(label); panel.add(textArea); @@ -247,8 +250,6 @@ public class DescriptionPanel extends JPanel { alignmentChoice = newIndex; - System.out.println("Updating alignment to index " + newIndex + ", " + alignmentOptions[newIndex]); - } private void updateBackgroundButtons(int newIndex) { @@ -258,9 +259,6 @@ public class DescriptionPanel extends JPanel { backgroundChoice = newIndex; - System.out.println("Updating background to index " + newIndex + ", " + backgroundOptions[newIndex]); - - } private void createButtons(String[] options, DefaultButton[] buttons, String type) { diff --git a/src/Dexterity.class b/src/Dexterity.class new file mode 100644 index 0000000..49ea697 Binary files /dev/null and b/src/Dexterity.class differ diff --git a/src/Dragonborn.class b/src/Dragonborn.class new file mode 100644 index 0000000..eb9eaa0 Binary files /dev/null and b/src/Dragonborn.class differ diff --git a/src/Dwarf.class b/src/Dwarf.class new file mode 100644 index 0000000..f46ee15 Binary files /dev/null and b/src/Dwarf.class differ diff --git a/src/Elf.class b/src/Elf.class new file mode 100644 index 0000000..842c652 Binary files /dev/null and b/src/Elf.class differ diff --git a/src/Fighter.class b/src/Fighter.class new file mode 100644 index 0000000..07dcf6c Binary files /dev/null and b/src/Fighter.class differ diff --git a/src/FileManager.class b/src/FileManager.class new file mode 100644 index 0000000..bc98be2 Binary files /dev/null and b/src/FileManager.class differ diff --git a/src/GUImanager.class b/src/GUImanager.class new file mode 100644 index 0000000..ad65b6e Binary files /dev/null and b/src/GUImanager.class differ diff --git a/src/GUImanager.java b/src/GUImanager.java index 663bf43..7e15bf4 100644 --- a/src/GUImanager.java +++ b/src/GUImanager.java @@ -4,7 +4,7 @@ import javax.swing.*; import java.awt.*; import java.util.*; -import src.AppConstants.*; +import static src.AppConstants.*; public class GUImanager extends JFrame { @@ -39,11 +39,13 @@ public class GUImanager extends JFrame { fileManager = new FileManager(); frameSetup(); setupPanelInfo(); + + ImageManager images = new ImageManager(); this.panels = new JPanel[]{ new MainMenuPanel(createNewCharacterButton(), createRandomCharacterButton(), createLoadButton()), - new BasicPanel(createNavPanel(), raceOptions, raceDescriptions, "Step 1: Choose Your Race"), // To choose Race. - new BasicPanel(createNavPanel(), classOptions, classDescriptions, "Step 2: Choose Your Class"), // To choose Class. + new BasicPanel(createNavPanel(), raceOptions, raceDescriptions, "Step 1: Choose Your Race", images), // To choose Race. + new BasicPanel(createNavPanel(), classOptions, classDescriptions, "Step 2: Choose Your Class", images), // To choose Class. new ChooseAbilityScoresPanel(createNavPanel(1), statOptions, statDescriptions, selectedStats, "Step 3: Choose Your Ability Scores"), new DescriptionPanel(createNavPanel(), characteristics, alignmentOptions, alignmentDescriptions, backgroundOptions, backgroundDescriptions, "Step 4: Describe your character"), new LoadCharacterPanel(createBackPanel(), loadableCharacters()), @@ -280,18 +282,20 @@ public class GUImanager extends JFrame { private DefaultButton createBackButton() { DefaultButton button = new DefaultButton("Back"); - button.addActionListener( - e -> { + button.addActionListener( - lastPanel--; - currentPanel--; - nextPanel--; - clearAndReset(); + e -> { - } + lastPanel--; + currentPanel--; + nextPanel--; - ); + clearAndReset(); + + } + + ); return button; @@ -300,18 +304,20 @@ public class GUImanager extends JFrame { private DefaultButton createBackButton(int manualBackPoint) { DefaultButton button = new DefaultButton("Back"); - button.addActionListener( - e -> { + button.addActionListener( - lastPanel = currentPanel; - currentPanel = manualBackPoint; - nextPanel = 0; - clearAndReset(); + e -> { - } + lastPanel = 0; + currentPanel = manualBackPoint; + nextPanel = 0; - ); + clearAndReset(); + + } + + ); return button; } @@ -319,18 +325,20 @@ public class GUImanager extends JFrame { private DefaultButton createContinueButton() { DefaultButton button = new DefaultButton("Continue"); - button.addActionListener( - e -> { + button.addActionListener( - lastPanel++; - currentPanel++; - nextPanel++; - clearAndReset(); + e -> { - } + lastPanel++; + currentPanel++; + nextPanel++; - ); + clearAndReset(); + + } + + ); return button; @@ -345,9 +353,10 @@ public class GUImanager extends JFrame { e -> { - lastPanel = currentPanel; + lastPanel = 0; currentPanel = 1; nextPanel = 2; + clearAndReset(); } @@ -362,20 +371,21 @@ public class GUImanager extends JFrame { private DefaultButton createRandomCharacterButton() { DefaultButton button = new DefaultButton("Create Random Character"); - button.addActionListener( - e -> { + button.addActionListener( - createRandomCharacter(); + e -> { - lastPanel = currentPanel; - currentPanel = 3; - nextPanel = currentPanel + 1; - clearAndReset(); + createRandomCharacter(); - } + lastPanel = currentPanel; + currentPanel = 3; + nextPanel = currentPanel + 1; + clearAndReset(); - ); + } + + ); return button; @@ -385,18 +395,19 @@ public class GUImanager extends JFrame { private DefaultButton createSaveButton() { DefaultButton button = new DefaultButton("Save"); - button.addActionListener( - e -> { + button.addActionListener( - lastPanel = currentPanel; - currentPanel = 6; - nextPanel = currentPanel + 1; - clearAndReset(); + e -> { - } + lastPanel = currentPanel; + currentPanel = 6; + nextPanel = currentPanel + 1; + clearAndReset(); - ); + } + + ); return button; @@ -405,26 +416,25 @@ public class GUImanager extends JFrame { private DefaultButton createLoadButton() { DefaultButton button = new DefaultButton("Load"); - button.addActionListener( - e -> { + button.addActionListener( - lastPanel = currentPanel; - currentPanel = 5; - clearAndReset(); + e -> { - } + lastPanel = currentPanel; + currentPanel = 5; + clearAndReset(); - ); + } - return button; + ); + + return button; } private ArrayList loadableCharacters() { - System.out.println("Loading characters..."); - saves = fileManager.getSaves(); savesButtons = new ArrayList<>(); @@ -448,13 +458,14 @@ public class GUImanager extends JFrame { private DefaultButton createLoadNCharacterButton(int index) { DefaultButton button = new DefaultButton(saves.get(index).getName()); + button.addActionListener( e -> { lastPanel = currentPanel; - panels[5] = new ViewCharacterPanel(createBackPanel(), saves.get(index)); - currentPanel = 5; + panels[6] = new ViewCharacterPanel(createBackPanel(), saves.get(index)); + currentPanel = 6; clearAndReset(); } diff --git a/src/Gnome.class b/src/Gnome.class new file mode 100644 index 0000000..ecc4bff Binary files /dev/null and b/src/Gnome.class differ diff --git a/src/HalfElf.class b/src/HalfElf.class new file mode 100644 index 0000000..49e0423 Binary files /dev/null and b/src/HalfElf.class differ diff --git a/src/HalfOrc.class b/src/HalfOrc.class new file mode 100644 index 0000000..bd3cd82 Binary files /dev/null and b/src/HalfOrc.class differ diff --git a/src/Halfling.class b/src/Halfling.class new file mode 100644 index 0000000..fb71122 Binary files /dev/null and b/src/Halfling.class differ diff --git a/src/Human.class b/src/Human.class new file mode 100644 index 0000000..3b08a96 Binary files /dev/null and b/src/Human.class differ diff --git a/src/ImageManager.class b/src/ImageManager.class new file mode 100644 index 0000000..93f021f Binary files /dev/null and b/src/ImageManager.class differ diff --git a/src/ImageManager.java b/src/ImageManager.java new file mode 100644 index 0000000..85a31aa --- /dev/null +++ b/src/ImageManager.java @@ -0,0 +1,116 @@ +package src; + +import javax.imageio.*; +import javax.swing.*; +import java.awt.*; +import java.awt.image.*; +import java.io.*; +import java.util.*; + +import static src.AppConstants.*; + +public class ImageManager extends FileManager { + + private static JLabel[][] racePortraits; + private static JLabel[][] classPortraits; + private static ArrayList savesPortraits; + + public ImageManager() { + + super(); + racePortraits = new JLabel[9][]; + classPortraits = new JLabel[12][]; + savesPortraits = new ArrayList<>(); + + createPortraitArray(racePortraits, "race"); + createPortraitArray(classPortraits, "class"); + createSavesPortraits(); + + } + + public JLabel getRacePortrait(int raceIndex) { + + return racePortraits[raceIndex][new Random().nextInt(racePortraits[raceIndex].length)]; + + } + + public JLabel getClassPortrait(int classIndex) { + + return classPortraits[classIndex][new Random().nextInt(classPortraits[classIndex].length)]; + + } + + private void createSavesPortraits() { + + File[] dir = new File(imgFilepath + "/saves/").listFiles(); + + for(File file : dir) { + + JLabel holder = image(file); + holder.setOpaque(true); + holder.setBackground(lightBrown); + + savesPortraits.add(holder); + + } + + } + + private void createPortraitArray(JLabel[][] portraits, String category) { + + File imgDir = new File(imgFilepath + category + "/"); + + File[] masterDir = imgDir.listFiles(); + + for(int i = 0; i < portraits.length; i++) { + + File[] tmpDir = masterDir[i].listFiles(); + + portraits[i] = new JLabel[tmpDir.length]; + + int index = 0; + + for(File file : tmpDir) { + + portraits[i][index] = image(file); + portraits[i][index].setOpaque(true); + portraits[i][index].setBackground(lightBrown); + //portraits[i][index].setBounds(bounds[3]); + + index++; + + } + + } + + } + + private JLabel image(File file) { + + BufferedImage img; + Image finalImg; + JLabel picture; + + try { + + img = ImageIO.read(file); + finalImg = img.getScaledInstance(250, 375, Image.SCALE_SMOOTH); + + } catch (IOException e) { + + System.out.println("File " + file.getPath() + " does not exist."); + img = null; + finalImg = null; + picture = null; + + return null; + + } + + picture = new JLabel(new ImageIcon(finalImg)); + + return picture; + + } + +} diff --git a/src/InfoPanel.class b/src/InfoPanel.class new file mode 100644 index 0000000..65faad6 Binary files /dev/null and b/src/InfoPanel.class differ diff --git a/src/Intelligence.class b/src/Intelligence.class new file mode 100644 index 0000000..f48b40c Binary files /dev/null and b/src/Intelligence.class differ diff --git a/src/LoadCharacter.class b/src/LoadCharacter.class new file mode 100644 index 0000000..16779ae Binary files /dev/null and b/src/LoadCharacter.class differ diff --git a/src/LoadCharacter.java b/src/LoadCharacter.java new file mode 100644 index 0000000..09661ea --- /dev/null +++ b/src/LoadCharacter.java @@ -0,0 +1,66 @@ +package src; + +import javax.swing.*; +import java.awt.*; +import javax.swing.border.*; + +public class LoadCharacter extends JPanel { + + public LoadCharacter() { + + setBackground(new Color(205, 133, 63)); + setLayout(new BorderLayout(0, 0)); + + JLabel lblNewLabel = new JLabel("Load a Character"); + lblNewLabel.setHorizontalAlignment(SwingConstants.CENTER); + lblNewLabel.setFont(new Font("Bodoni 72 Oldstyle", Font.PLAIN, 31)); + add(lblNewLabel, BorderLayout.NORTH); + + JPanel loadCharacterMainPanel = new JPanel(); + loadCharacterMainPanel.setOpaque(false); + add(loadCharacterMainPanel, BorderLayout.CENTER); + loadCharacterMainPanel.setLayout(null); + + JPanel characterLoadPanel = new JPanel(); + characterLoadPanel.setBackground(new Color(210, 180, 140)); + characterLoadPanel.setBorder(new BevelBorder(BevelBorder.LOWERED, null, null, null, null)); + characterLoadPanel.setBounds(54, 47, 340, 346); + loadCharacterMainPanel.add(characterLoadPanel); + characterLoadPanel.setLayout(new GridLayout(5, 1, 0, 0)); + + JButton characterSave1 = new JButton("Load Character 1"); + characterLoadPanel.add(characterSave1); + + JButton characterSave2 = new JButton("Load Character 2"); + characterLoadPanel.add(characterSave2); + + JButton characterSave3 = new JButton("Load Character 3"); + characterLoadPanel.add(characterSave3); + + JButton characterSave4 = new JButton("Load Character 4"); + characterLoadPanel.add(characterSave4); + + JButton characterSave5 = new JButton("Load Character 5"); + characterLoadPanel.add(characterSave5); + + JButton goBtn = new JButton("Go"); + goBtn.setOpaque(true); + goBtn.setBackground(new Color(210, 105, 30)); + goBtn.setBorder(new BevelBorder(BevelBorder.LOWERED, null, null, null, null)); + goBtn.setFont(new Font("Lucida Grande", Font.PLAIN, 30)); + goBtn.setBounds(481, 261, 124, 50); + loadCharacterMainPanel.add(goBtn); + + JButton goBack = new JButton("Go Back"); + goBack.setOpaque(true); + goBack.setBackground(new Color(210, 105, 30)); + goBack.setBorder(new BevelBorder(BevelBorder.LOWERED, null, null, null, null)); + goBack.setFont(new Font("Lucida Grande", Font.PLAIN, 30)); + goBack.setBounds(481, 343, 124, 50); + loadCharacterMainPanel.add(goBack); + + } + + + +} diff --git a/src/LoadCharacterPanel.class b/src/LoadCharacterPanel.class new file mode 100644 index 0000000..96facad Binary files /dev/null and b/src/LoadCharacterPanel.class differ diff --git a/src/MainMenuPanel.class b/src/MainMenuPanel.class new file mode 100644 index 0000000..e94b84d Binary files /dev/null and b/src/MainMenuPanel.class differ diff --git a/src/Race.class b/src/Race.class new file mode 100644 index 0000000..ea9c95d Binary files /dev/null and b/src/Race.class differ diff --git a/src/Skills.class b/src/Skills.class new file mode 100644 index 0000000..a5083de Binary files /dev/null and b/src/Skills.class differ diff --git a/src/Stats.class b/src/Stats.class new file mode 100644 index 0000000..fe4239d Binary files /dev/null and b/src/Stats.class differ diff --git a/src/Strength.class b/src/Strength.class new file mode 100644 index 0000000..af4860c Binary files /dev/null and b/src/Strength.class differ diff --git a/src/Tester.class b/src/Tester.class new file mode 100644 index 0000000..9a8cb14 Binary files /dev/null and b/src/Tester.class differ diff --git a/src/Tester.java b/src/Tester.java new file mode 100644 index 0000000..32dc6ef --- /dev/null +++ b/src/Tester.java @@ -0,0 +1,40 @@ +package src; + +public class Tester { + + public static void main(String[] args) { + + FileManager filer = new FileManager(); + + filer.saveCharacter(createSheet()); + + CharacterSheet chFromFile = filer.readSavedCharacter(0); + + System.out.println("chFromFile: \n" + chFromFile.toString()); + + } + + public static CharacterSheet createSheet() { + + String name = "Josh"; + int age = 21; + int heightFeet = 5; + int heightInch = 8; + int weight = 180; + String eyeColor = "Brown"; + String hairColor = "Dark Brown"; + + Race race = new Elf(); + ClassTemplate chClass = new Fighter(); + CharacterStats stats = new CharacterStats(9, 15, 12, 10, 13, 10); + + String alignment = "Neutral"; + String background = "Nomad"; + + CharacterSheet chTest = new CharacterSheet(name, age, heightFeet, heightInch, weight, eyeColor, hairColor, race, chClass, alignment, background, stats); + + return chTest; + + } + +} diff --git a/src/Tiefling.class b/src/Tiefling.class new file mode 100644 index 0000000..44e3ca9 Binary files /dev/null and b/src/Tiefling.class differ diff --git a/src/ViewCharacterPanel.class b/src/ViewCharacterPanel.class new file mode 100644 index 0000000..124d933 Binary files /dev/null and b/src/ViewCharacterPanel.class differ diff --git a/src/ViewCharacterPanel.java b/src/ViewCharacterPanel.java new file mode 100644 index 0000000..1ba898e --- /dev/null +++ b/src/ViewCharacterPanel.java @@ -0,0 +1,77 @@ +package src; + +import java.awt.*; +import javax.swing.*; + +import static src.AppConstants.*; + +public class ViewCharacterPanel extends JPanel { + + private CharacterSheet sheet; + + public ViewCharacterPanel(JPanel nav, CharacterSheet sheet) { + + super(); + this.sheet = sheet; + panelSetup(); + createMasterPanel(); + + add(nav, BorderLayout.SOUTH); + + } + + public void changeCharacter(CharacterSheet sheet) { + + this.sheet = sheet; + + repaint(); + revalidate(); + + } + + private void panelSetup() { + + setBackground(lightBrown); + setLayout(new BorderLayout(0, 0)); + + } + + private void createMasterPanel() { + + JLabel title = new JLabel(sheet.getName()); + title.setHorizontalAlignment(SwingConstants.CENTER); + title.setFont(headerFont); + title.setForeground(darkestBrown); + + add(title, BorderLayout.NORTH); + + add(createCharacteristicsPanel(), BorderLayout.CENTER); + + } + + private JPanel createCharacteristicsPanel() { + + JPanel panel = new JPanel(new GridLayout(2, 4, 15, 15)); + panel.setOpaque(false); + + panel.add(new JLabel("Age: " + sheet.getAge())); + + panel.add(new JLabel("Height: " + sheet.getHeightFeet() + "\'" + sheet.getHeightInch() + "\"")); + + panel.add(new JLabel("Weight: " + sheet.getWeight() + "lbs.")); + + panel.add(new JLabel("Eye Color: " + sheet.getEyeColor())); + + panel.add(new JLabel("Hair Color: " + sheet.getHairColor())); + + panel.add(new JLabel("Race: " + sheet.getRace().toString())); + + panel.add(new JLabel("Class: " + sheet.getCharacterClass().toString())); + + panel.add(new JLabel("Ability Scores: " + sheet.getStats().toString())); + + return panel; + + } + +} diff --git a/src/Wisdom.class b/src/Wisdom.class new file mode 100644 index 0000000..ee7f088 Binary files /dev/null and b/src/Wisdom.class differ diff --git a/src/Wizard.class b/src/Wizard.class new file mode 100644 index 0000000..da885c8 Binary files /dev/null and b/src/Wizard.class differ