Add files via upload
This commit is contained in:
Binary file not shown.
Binary file not shown.
@@ -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);
|
||||
|
||||
}
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
+20
-14
@@ -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);
|
||||
|
||||
}
|
||||
|
||||
Binary file not shown.
@@ -30,6 +30,8 @@ public class CharacterSheet implements Serializable {
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
|
||||
public CharacterSheet(
|
||||
|
||||
String name,
|
||||
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
+43
-45
@@ -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) {
|
||||
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
+68
-57
@@ -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<DefaultButton> 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();
|
||||
|
||||
}
|
||||
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -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<JLabel> 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;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -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);
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -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;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
Binary file not shown.
Binary file not shown.
@@ -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;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
Binary file not shown.
Binary file not shown.
Reference in New Issue
Block a user