Refactoring.
This commit is contained in:
@@ -46,12 +46,10 @@ public class CharacterStats {
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* Allows for access to a particular stat.
|
||||
*
|
||||
* @param index
|
||||
* @return a specific stat
|
||||
*
|
||||
*/
|
||||
public Stats getStats(int index) {
|
||||
|
||||
|
||||
@@ -1,15 +1,13 @@
|
||||
package Character;
|
||||
|
||||
import java.util.Arrays;
|
||||
|
||||
public class Background {
|
||||
|
||||
int backgroundIndex;
|
||||
private String name;
|
||||
private boolean[] proficientStatus;
|
||||
private String[] skills;
|
||||
private String feature;
|
||||
private String skillProficiencies;
|
||||
int backgroundIndex;
|
||||
|
||||
/**
|
||||
* @param name
|
||||
@@ -124,12 +122,14 @@ public class Background {
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the skillProficiencies
|
||||
*/
|
||||
public String getskillProficiences() {
|
||||
return skillProficiencies;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the feature
|
||||
*/
|
||||
@@ -151,5 +151,4 @@ public class Background {
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -1,8 +1,7 @@
|
||||
package Character;
|
||||
|
||||
import Character.AbilityScores.CharacterStats;
|
||||
import Character.Classes.ClassTemplate;
|
||||
import Character.Races.*;
|
||||
import Character.Races.Race;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
@@ -41,6 +40,7 @@ public class CharacterSheet implements Serializable {
|
||||
this.race = race;
|
||||
this.stats = stats;
|
||||
}
|
||||
|
||||
/**
|
||||
* Default constructor
|
||||
*/
|
||||
@@ -54,42 +54,49 @@ public class CharacterSheet implements Serializable {
|
||||
this.hair = "null";
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the name
|
||||
*/
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the age
|
||||
*/
|
||||
public int getAge() {
|
||||
return age;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the heightFeet
|
||||
*/
|
||||
public int getHeightFeet() {
|
||||
return heightFeet;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the heightInch
|
||||
*/
|
||||
public int getHeightInch() {
|
||||
return heightInch;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the weigth
|
||||
*/
|
||||
public int getWeight() {
|
||||
return weight;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the eye
|
||||
*/
|
||||
public String getEye() {
|
||||
return eye;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the hair
|
||||
*/
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
package Character.Classes;
|
||||
|
||||
import Character.AbilityScores.*;
|
||||
import Character.AbilityScores.Stats;
|
||||
|
||||
public interface ClassTemplate {
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
package Character.Classes;
|
||||
|
||||
import Character.AbilityScores.*;
|
||||
import Character.AbilityScores.Stats;
|
||||
|
||||
public class Cleric implements ClassTemplate {
|
||||
|
||||
@@ -14,7 +14,6 @@ public class Cleric implements ClassTemplate {
|
||||
public Cleric(Stats[] stats, int level) {
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
// TODO: Need to figure out how to contain class progression information. Potentially a double String array, each row equals a level, each column a different thing. Should class features be a separate class, ie. BarbFeatures, BardFeatures, etc?
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
package Character.Classes;
|
||||
|
||||
import Character.AbilityScores.*;
|
||||
import Character.AbilityScores.Stats;
|
||||
|
||||
public class Fighter implements ClassTemplate {
|
||||
|
||||
@@ -14,7 +14,6 @@ public class Fighter implements ClassTemplate {
|
||||
public Fighter(Stats[] stats, int level) {
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
// TODO: Need to figure out how to contain class progression information. Potentially a double String array, each row equals a level, each column a different thing. Should class features be a separate class, ie. BarbFeatures, BardFeatures, etc?
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package Character.Classes;
|
||||
|
||||
import Character.AbilityScores.*;
|
||||
import Character.AbilityScores.Stats;
|
||||
|
||||
public class Wizard implements ClassTemplate {
|
||||
|
||||
private int HP;
|
||||
@@ -13,7 +14,6 @@ public class Wizard implements ClassTemplate {
|
||||
public Wizard(Stats[] stats, int level) {
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
// TODO: Need to figure out how to contain class progression information. Potentially a double String array, each row equals a level, each column a different thing. Should class features be a separate class, ie. BarbFeatures, BardFeatures, etc?
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
package Character.Races;
|
||||
|
||||
public class Dragonborn implements Race {
|
||||
private String[] traits;
|
||||
private final int speed = 30;
|
||||
private final int maxAge = 80;
|
||||
private String[] traits;
|
||||
private String[] skills;
|
||||
private String[] languages;
|
||||
private String[] proficiencies;
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
package Character.Races;
|
||||
|
||||
public class Dwarf implements Race {
|
||||
private String[] traits;
|
||||
private final int speed = 25;
|
||||
private final int maxAge = 350;
|
||||
private String[] traits;
|
||||
private String[] skills;
|
||||
private String[] languages;
|
||||
private String[] proficiencies;
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
package Character.Races;
|
||||
|
||||
public class Elf implements Race {
|
||||
private String[] traits;
|
||||
private final int speed = 30;
|
||||
private final int maxAge = 750;
|
||||
private String[] traits;
|
||||
private String[] skills;
|
||||
private String[] languages;
|
||||
private String[] proficiencies;
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
package Character.Races;
|
||||
|
||||
public class Gnome implements Race {
|
||||
private String[] traits;
|
||||
private final int speed = 25;
|
||||
private final int maxAge = 500;
|
||||
private String[] traits;
|
||||
private String[] skills;
|
||||
private String[] languages;
|
||||
private String[] proficiencies;
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
package Character.Races;
|
||||
|
||||
public class HalfElf implements Race {
|
||||
private String[] traits;
|
||||
private final int speed = 30;
|
||||
private final int maxAge = 180;
|
||||
private String[] traits;
|
||||
private String[] skills;
|
||||
private String[] languages;
|
||||
private String[] proficiencies;
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
package Character.Races;
|
||||
|
||||
public class HalfOrc implements Race {
|
||||
private String[] traits;
|
||||
private final int speed = 30;
|
||||
private final int maxAge = 75;
|
||||
private String[] traits;
|
||||
private String[] skills;
|
||||
private String[] languages;
|
||||
private String[] proficiencies;
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
package Character.Races;
|
||||
|
||||
public class Halfling implements Race {
|
||||
private String[] traits;
|
||||
private final int speed = 30;
|
||||
private final int maxAge = 750;
|
||||
private String[] traits;
|
||||
private String[] skills;
|
||||
private String[] languages;
|
||||
private String[] proficiencies;
|
||||
|
||||
@@ -2,9 +2,9 @@ package Character.Races;
|
||||
|
||||
public class Human implements Race {
|
||||
|
||||
private String[] traits;
|
||||
private final int speed = 30;
|
||||
private final int maxAge = 80;
|
||||
private String[] traits;
|
||||
private String[] skills;
|
||||
private String[] languages;
|
||||
private String[] proficiencies;
|
||||
|
||||
@@ -44,5 +44,4 @@ public interface Race {
|
||||
// }
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
package Character.Races;
|
||||
|
||||
public class Tiefling implements Race {
|
||||
private String[] traits;
|
||||
private final int speed = 30;
|
||||
private final int maxAge = 85;
|
||||
private String[] traits;
|
||||
private String[] skills;
|
||||
private String[] languages;
|
||||
private String[] proficiencies;
|
||||
|
||||
@@ -1,33 +1,27 @@
|
||||
package Character;
|
||||
|
||||
import Character.AbilityScores.*;
|
||||
import Character.AbilityScores.Stats;
|
||||
|
||||
/**
|
||||
*
|
||||
* 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
|
||||
* which adds any proficiency bonus to each skill and then adds the ability score modifier to each skill.
|
||||
*
|
||||
*/
|
||||
public class Skills {
|
||||
|
||||
// TODO: Need to verify skills are in correct order.
|
||||
private String[] allSkillsText = {"Acrobatics", "Animal Handling", "Arcana", "Athletics", "Deception", "History", "Insight", "Intimidation", "Investigation", "Medicine", "Nature", "Perception", "Performance", "Persuasion", "Religion", "Sleight of Hand", "Stealth", "Survival"};
|
||||
|
||||
// TODO: Prof bonus comes from the class, changes upon certain level thresholds.
|
||||
private final int profBonus = 5;
|
||||
|
||||
// TODO: Need to verify skills are in correct order.
|
||||
private String[] allSkillsText = {"Acrobatics", "Animal Handling", "Arcana", "Athletics", "Deception", "History", "Insight", "Intimidation", "Investigation", "Medicine", "Nature", "Perception", "Performance", "Persuasion", "Religion", "Sleight of Hand", "Stealth", "Survival"};
|
||||
private Stats[] stats;
|
||||
|
||||
private int[] 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.
|
||||
*
|
||||
* @param skills
|
||||
* @param stats
|
||||
*
|
||||
*/
|
||||
public Skills(int[] skills, Stats[] stats) {
|
||||
|
||||
@@ -40,9 +34,7 @@ public class Skills {
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* Adds proficiency bonus to each element of the skills array, and then adds the corresponding AS modifier to each skill.
|
||||
*
|
||||
*/
|
||||
private void setSkills() {
|
||||
|
||||
@@ -64,11 +56,9 @@ public class Skills {
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* Returns the value of each skill's score.
|
||||
*
|
||||
* @return int[] skills
|
||||
*
|
||||
*/
|
||||
public int[] getSkills() {
|
||||
|
||||
|
||||
@@ -4,16 +4,12 @@
|
||||
*/
|
||||
package DieRoller;
|
||||
|
||||
import javax.swing.*;
|
||||
import java.util.Arrays;
|
||||
import javax.swing.JComboBox;
|
||||
import javax.swing.JOptionPane;
|
||||
import javax.swing.JTextField;
|
||||
|
||||
public class DiceRoller
|
||||
{
|
||||
public class DiceRoller {
|
||||
|
||||
public static void main(String[] args)
|
||||
{
|
||||
public static void main(String[] args) {
|
||||
|
||||
JTextField diceNum = new JTextField();
|
||||
JTextField diceMod = new JTextField();
|
||||
@@ -39,29 +35,24 @@ public class DiceRoller
|
||||
JOptionPane.showMessageDialog(null, rollString, "Dice Rolls", JOptionPane.INFORMATION_MESSAGE);
|
||||
}
|
||||
|
||||
public static int[] rollDice(int numberOfDice, int sizeOfDice)
|
||||
{
|
||||
public static int[] rollDice(int numberOfDice, int sizeOfDice) {
|
||||
int[] diceRolls = new int[numberOfDice];
|
||||
for (int rolledDice = 0; rolledDice < diceRolls.length; rolledDice++)
|
||||
{
|
||||
for (int rolledDice = 0; rolledDice < diceRolls.length; rolledDice++) {
|
||||
diceRolls[rolledDice] = (int) (Math.random() * sizeOfDice) + 1;
|
||||
}
|
||||
return diceRolls;
|
||||
}
|
||||
|
||||
public static int rollTotal(int[] diceRolls, int modifier)
|
||||
{
|
||||
public static int rollTotal(int[] diceRolls, int modifier) {
|
||||
int rollTotal = 0;
|
||||
for (int index = 0; index < diceRolls.length; index++)
|
||||
{
|
||||
for (int index = 0; index < diceRolls.length; index++) {
|
||||
rollTotal += diceRolls[index];
|
||||
}
|
||||
rollTotal += modifier;
|
||||
return rollTotal;
|
||||
}
|
||||
|
||||
public static String modifierString(int modifier)
|
||||
{
|
||||
public static String modifierString(int modifier) {
|
||||
String modifierString = "";
|
||||
if (modifier < 0)
|
||||
modifierString += modifier;
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import GUI.*;
|
||||
import FileManagement.*;
|
||||
import FileManagement.FileManager;
|
||||
import GUI.GUImanager;
|
||||
|
||||
public class DndCharacterBuilder {
|
||||
|
||||
|
||||
@@ -5,7 +5,6 @@ public class ExportPDF {
|
||||
public ExportPDF() {
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,10 +1,9 @@
|
||||
package FileManagement;
|
||||
|
||||
import Character.CharacterSheet;
|
||||
|
||||
import java.awt.*;
|
||||
import java.io.*;
|
||||
import java.util.Arrays;
|
||||
|
||||
import Character.*;
|
||||
|
||||
public class FileManager {
|
||||
|
||||
|
||||
@@ -1,6 +1,9 @@
|
||||
package GUI;
|
||||
|
||||
import GUI.Panels.*;
|
||||
import GUI.Panels.BasicPanel;
|
||||
import GUI.Panels.ChooseAbilityScoresPanel;
|
||||
import GUI.Panels.DescriptionPanel;
|
||||
import GUI.Panels.MainMenuPanel;
|
||||
import Resources.CustomAssets.BasicNavPanel;
|
||||
import Resources.CustomAssets.DefaultButton;
|
||||
|
||||
@@ -32,28 +35,23 @@ public class GUImanager extends JFrame {
|
||||
private int[] selectedStats;
|
||||
|
||||
|
||||
|
||||
public GUImanager(boolean returningUser) {
|
||||
super("D&D Character Builder");
|
||||
frameSetup();
|
||||
setupPanelInfo();
|
||||
this.panels = new JPanel[]{
|
||||
new MainMenuPanel(),
|
||||
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 ChooseAbilityScoresPanel(createNavPanel(27), statOptions, statDescriptions, selectedStats, "Step 3: Choose Your Ability Scores"),
|
||||
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")
|
||||
};
|
||||
|
||||
this.currentPanel = 4;
|
||||
/*
|
||||
this.currentPanel = 0;
|
||||
this.lastPanel = currentPanel - 1;
|
||||
this.nextPanel = currentPanel + 1;
|
||||
this.nextPanel = currentPanel + 1;*/
|
||||
|
||||
/* this.lastPanel = 0;
|
||||
this.currentPanel = 1;
|
||||
this.nextPanel = 2;*/
|
||||
|
||||
/* if (returningUser) {
|
||||
if (returningUser) {
|
||||
|
||||
this.currentPanel = 0;
|
||||
|
||||
@@ -62,7 +60,6 @@ public class GUImanager extends JFrame {
|
||||
this.currentPanel = 1;
|
||||
|
||||
}
|
||||
*/
|
||||
|
||||
add(panels[currentPanel]);
|
||||
|
||||
@@ -312,6 +309,15 @@ public class GUImanager extends JFrame {
|
||||
|
||||
}
|
||||
|
||||
private DefaultButton createNewCharacterButton() {
|
||||
|
||||
DefaultButton button = createContinueButton();
|
||||
button.setText("Create New Character");
|
||||
|
||||
return button;
|
||||
|
||||
}
|
||||
|
||||
// TODO: Need to implement.
|
||||
private DefaultButton createRandomCharacterButton() {
|
||||
|
||||
@@ -323,7 +329,7 @@ public class GUImanager extends JFrame {
|
||||
createRandomCharacter();
|
||||
|
||||
lastPanel = currentPanel;
|
||||
currentPanel = 6;
|
||||
currentPanel = 3;
|
||||
nextPanel = currentPanel + 1;
|
||||
clearAndReset();
|
||||
|
||||
@@ -335,7 +341,7 @@ public class GUImanager extends JFrame {
|
||||
|
||||
}
|
||||
|
||||
// TODO: Need to implement.
|
||||
// TODO: Need to implement with exact indices and file manager logic.
|
||||
private DefaultButton createSaveButton() {
|
||||
|
||||
DefaultButton button = new DefaultButton("Save");
|
||||
@@ -356,10 +362,30 @@ public class GUImanager extends JFrame {
|
||||
|
||||
}
|
||||
|
||||
// TODO: Need to implement.
|
||||
private DefaultButton createLoadButton() {
|
||||
|
||||
DefaultButton button = new DefaultButton("Load");
|
||||
button.addActionListener(
|
||||
|
||||
e -> {
|
||||
|
||||
lastPanel = currentPanel;
|
||||
currentPanel = 3;
|
||||
nextPanel = currentPanel + 1;
|
||||
clearAndReset();
|
||||
|
||||
}
|
||||
|
||||
);
|
||||
|
||||
return button;
|
||||
|
||||
}
|
||||
|
||||
// TODO: Need to implement random character creation.
|
||||
private void createRandomCharacter() {
|
||||
|
||||
|
||||
System.out.println("Request to create random character. Need to implement.");
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
package GUI.Panels;
|
||||
|
||||
import GUI.AppTheme;
|
||||
import Resources.CustomAssets.*;
|
||||
|
||||
import java.awt.*;
|
||||
import Resources.CustomAssets.DefaultButton;
|
||||
import Resources.CustomAssets.ImageInfoPanel;
|
||||
|
||||
import javax.swing.*;
|
||||
import java.awt.*;
|
||||
|
||||
public class BasicPanel extends JPanel implements AppTheme {
|
||||
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
package GUI.Panels;
|
||||
|
||||
import GUI.AppTheme;
|
||||
import Resources.CustomAssets.InfoPanel;
|
||||
import Resources.CustomAssets.BasicNavPanel;
|
||||
import Resources.CustomAssets.DefaultButton;
|
||||
import Resources.CustomAssets.InfoPanel;
|
||||
|
||||
import javax.swing.*;
|
||||
import javax.swing.border.LineBorder;
|
||||
@@ -116,17 +116,14 @@ public class ChooseAbilityScoresPanel extends JPanel implements AppTheme {
|
||||
JLabel scoreLabel = new JLabel("" + selectedStats[statIndex]);
|
||||
scoreLabel.setFont(paragraphFont);
|
||||
scoreLabel.setHorizontalAlignment(SwingConstants.CENTER);
|
||||
scoreLabel.setBounds(56, 50, 30, 30);
|
||||
|
||||
statLabels[statIndex] = scoreLabel;
|
||||
|
||||
|
||||
DefaultButton increaseButton = new DefaultButton("+");
|
||||
increaseButton.setBounds(90, 50, 50, 50);
|
||||
increaseButton.addActionListener(e -> increase(statIndex));
|
||||
|
||||
DefaultButton decreaseButton = new DefaultButton("-");
|
||||
decreaseButton.setBounds(21, 50, 50, 50);
|
||||
decreaseButton.addActionListener(e -> decrease(statIndex));
|
||||
|
||||
subPanel.add(decreaseButton);
|
||||
|
||||
@@ -3,7 +3,6 @@ package GUI.Panels;
|
||||
import GUI.AppTheme;
|
||||
import Resources.CustomAssets.BasicNavPanel;
|
||||
import Resources.CustomAssets.DefaultButton;
|
||||
import Resources.CustomAssets.InfoPanel;
|
||||
|
||||
import javax.swing.*;
|
||||
import javax.swing.border.EmptyBorder;
|
||||
@@ -87,7 +86,6 @@ public class DescriptionPanel extends JPanel implements AppTheme {
|
||||
}
|
||||
|
||||
|
||||
|
||||
private void createPanel(String panelTitle, BasicNavPanel nav) {
|
||||
|
||||
add(createPanelTitle(panelTitle), BorderLayout.NORTH);
|
||||
@@ -165,80 +163,59 @@ public class DescriptionPanel extends JPanel implements AppTheme {
|
||||
|
||||
JPanel panel = new JPanel(new GridLayout(1, 3));
|
||||
panel.setOpaque(false);
|
||||
panel.add(createAlignmentPanel());
|
||||
panel.add(createBackgroundPanel());
|
||||
panel.add(createSubPanel("Alignment"));
|
||||
panel.add(createSubPanel("Background"));
|
||||
panel.add(createTextBoxPanel());
|
||||
|
||||
return panel;
|
||||
|
||||
}
|
||||
|
||||
private JPanel createAlignmentPanel() {
|
||||
private JPanel createSubPanel(String labelName) {
|
||||
|
||||
JPanel alignmentPanel = new JPanel(new BorderLayout(0, 0));
|
||||
alignmentPanel.setBorder(new EmptyBorder(5, 5, 5, 5));
|
||||
alignmentPanel.setOpaque(false);
|
||||
JPanel panel = new JPanel(new BorderLayout(0, 0));
|
||||
panel.setBorder(new EmptyBorder(5, 5, 5, 5));
|
||||
panel.setOpaque(false);
|
||||
|
||||
JLabel backgroundLabel = new JLabel("Alignment");
|
||||
backgroundLabel.setForeground(darkestBrown);
|
||||
backgroundLabel.setFont(subHeaderFont);
|
||||
backgroundLabel.setHorizontalAlignment(SwingConstants.CENTER);
|
||||
JLabel label = new JLabel(labelName);
|
||||
label.setForeground(darkestBrown);
|
||||
label.setFont(subHeaderFont);
|
||||
label.setHorizontalAlignment(SwingConstants.CENTER);
|
||||
|
||||
JPanel innerPanel = new JPanel(new GridLayout(9, 1));
|
||||
JPanel innerPanel;
|
||||
|
||||
if(labelName.equals("Alignment")) {
|
||||
|
||||
innerPanel = new JPanel(new GridLayout(9, 1));
|
||||
innerPanel.setOpaque(false);
|
||||
|
||||
for (int i = 0; i < alignmentOptions.length; i++) {
|
||||
createButtons(alignmentOptions, alignmentButtons, labelName);
|
||||
|
||||
for (int i = 0; i < alignmentButtons.length; i++) {
|
||||
|
||||
alignmentButtons[i] = createButton(alignmentOptions[i], false, i);
|
||||
innerPanel.add(alignmentButtons[i]);
|
||||
|
||||
if(i == 0) {
|
||||
|
||||
alignmentButtons[i].select();
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
} else {
|
||||
|
||||
alignmentPanel.add(backgroundLabel, BorderLayout.NORTH);
|
||||
alignmentPanel.add(innerPanel);
|
||||
|
||||
return alignmentPanel;
|
||||
|
||||
}
|
||||
|
||||
private JPanel createBackgroundPanel() {
|
||||
|
||||
JPanel backgroundPanel = new JPanel(new BorderLayout(0, 0));
|
||||
backgroundPanel.setBorder(new EmptyBorder(5, 5, 5, 5));
|
||||
backgroundPanel.setOpaque(false);
|
||||
|
||||
JLabel backgroundLabel = new JLabel("Background");
|
||||
backgroundLabel.setForeground(darkestBrown);
|
||||
backgroundLabel.setFont(subHeaderFont);
|
||||
backgroundLabel.setHorizontalAlignment(SwingConstants.CENTER);
|
||||
|
||||
backgroundPanel.add(backgroundLabel, BorderLayout.NORTH);
|
||||
|
||||
JPanel innerPanel = new JPanel(new GridLayout(9, 2));
|
||||
innerPanel = new JPanel(new GridLayout(9, 2));
|
||||
innerPanel.setOpaque(false);
|
||||
|
||||
for (int i = 0; i < backgroundOptions.length; i++) {
|
||||
createButtons(backgroundOptions, backgroundButtons, labelName);
|
||||
|
||||
for (int i = 0; i < backgroundButtons.length; i++) {
|
||||
|
||||
backgroundButtons[i] = createButton(backgroundOptions[i], false, i);
|
||||
innerPanel.add(backgroundButtons[i]);
|
||||
|
||||
if(i == 0) {
|
||||
|
||||
backgroundButtons[i].select();
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
backgroundPanel.add(innerPanel);
|
||||
panel.add(label);
|
||||
panel.add(innerPanel);
|
||||
|
||||
return backgroundPanel;
|
||||
return panel;
|
||||
|
||||
}
|
||||
|
||||
@@ -288,6 +265,24 @@ public class DescriptionPanel extends JPanel implements AppTheme {
|
||||
|
||||
}
|
||||
|
||||
private void createButtons(String[] options, DefaultButton[] buttons, String type) {
|
||||
|
||||
boolean tmp = type.equals("Alignment");
|
||||
|
||||
for (int i = 0; i < options.length; i++) {
|
||||
|
||||
buttons[i] = createButton(options[i], tmp, i);
|
||||
|
||||
if(i == 0) {
|
||||
|
||||
buttons[i].select();
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private DefaultButton createButton(String name, boolean isAlignmentElseBackground, int index) {
|
||||
|
||||
DefaultButton button = new DefaultButton(name);
|
||||
|
||||
@@ -1,83 +1,69 @@
|
||||
package GUI.Panels;
|
||||
|
||||
import javax.swing.JPanel;
|
||||
import java.awt.BorderLayout;
|
||||
import javax.swing.JLabel;
|
||||
import javax.swing.SwingConstants;
|
||||
import java.awt.Font;
|
||||
import java.awt.Color;
|
||||
import GUI.AppTheme;
|
||||
import Resources.CustomAssets.DefaultButton;
|
||||
|
||||
import javax.swing.*;
|
||||
import javax.swing.border.BevelBorder;
|
||||
import javax.swing.JButton;
|
||||
import java.awt.event.ActionListener;
|
||||
import javax.swing.border.EmptyBorder;
|
||||
import java.awt.*;
|
||||
import java.awt.event.ActionEvent;
|
||||
import java.awt.event.ActionListener;
|
||||
|
||||
public class MainMenuPanel extends JPanel {
|
||||
public class MainMenuPanel extends JPanel implements AppTheme {
|
||||
|
||||
/**
|
||||
* Create the panel.
|
||||
*/
|
||||
public MainMenuPanel() {
|
||||
setBackground(new Color(222, 184, 135));
|
||||
setBorder(new BevelBorder(BevelBorder.RAISED, new Color(160, 82, 45), new Color(165, 42, 42), new Color(0, 0, 0), null));
|
||||
private DefaultButton newCharacter;
|
||||
private DefaultButton randomCharacter;
|
||||
private DefaultButton loadCharacter;
|
||||
|
||||
public MainMenuPanel(DefaultButton newCharacter, DefaultButton randomCharacter, DefaultButton loadCharacter) {
|
||||
|
||||
super();
|
||||
panelSetup();
|
||||
this.newCharacter = newCharacter;
|
||||
this.randomCharacter = randomCharacter;
|
||||
this.loadCharacter = loadCharacter;
|
||||
|
||||
add(createLabel(), BorderLayout.NORTH);
|
||||
|
||||
add(createControlPanel(), BorderLayout.CENTER);
|
||||
}
|
||||
|
||||
private void panelSetup() {
|
||||
|
||||
setBackground(lightBrown);
|
||||
setLayout(new BorderLayout(0, 0));
|
||||
|
||||
JLabel mainMenuLbl = mainMenuLbl();
|
||||
add(mainMenuLbl, BorderLayout.NORTH);
|
||||
|
||||
JPanel controlPanel = createControlPanel();
|
||||
add(controlPanel, BorderLayout.CENTER);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return
|
||||
*/
|
||||
private JLabel createLabel() {
|
||||
|
||||
JLabel label = new JLabel("D&D Character Builder");
|
||||
label.setFont(headerFont);
|
||||
label.setForeground(darkestBrown);
|
||||
label.setOpaque(false);
|
||||
label.setHorizontalAlignment(SwingConstants.CENTER);
|
||||
label.setBorder(new EmptyBorder(5, 5, 5, 5));
|
||||
|
||||
return label;
|
||||
|
||||
}
|
||||
|
||||
private JPanel createControlPanel() {
|
||||
JPanel controlPanel = new JPanel();
|
||||
controlPanel.setOpaque(false);
|
||||
controlPanel.setLayout(null);
|
||||
JPanel panel = new JPanel(new GridLayout(1, 2, 50, 0));
|
||||
panel.setOpaque(false);
|
||||
panel.setBorder(new EmptyBorder(25, 25, 25, 25));
|
||||
|
||||
JButton newCharBtn = new JButton("New \nCharacter");
|
||||
newCharBtn.addActionListener(new ActionListener() {
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
}
|
||||
});
|
||||
newCharBtn.setOpaque(true);
|
||||
newCharBtn.setBackground(new Color(160, 82, 45));
|
||||
newCharBtn.setFont(new Font("Bodoni 72 Oldstyle", Font.PLAIN, 23));
|
||||
newCharBtn.setBounds(118, 90, 200, 50);
|
||||
controlPanel.add(newCharBtn);
|
||||
JPanel subPanel = new JPanel(new GridLayout(2, 1, 0, 50));
|
||||
subPanel.setOpaque(false);
|
||||
|
||||
JButton randCharacterBtn = new JButton("Random Character");
|
||||
randCharacterBtn.addActionListener(new ActionListener() {
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
}
|
||||
});
|
||||
randCharacterBtn.setOpaque(true);
|
||||
randCharacterBtn.setBackground(new Color(160, 82, 45));
|
||||
randCharacterBtn.setFont(new Font("Bodoni 72 Oldstyle", Font.PLAIN, 23));
|
||||
randCharacterBtn.setBounds(118, 156, 200, 50);
|
||||
controlPanel.add(randCharacterBtn);
|
||||
subPanel.add(newCharacter);
|
||||
subPanel.add(randomCharacter);
|
||||
|
||||
JButton loadCharacter = new JButton("Load Character");
|
||||
loadCharacter.addActionListener(new ActionListener() {
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
}
|
||||
});
|
||||
loadCharacter.setOpaque(true);
|
||||
loadCharacter.setBackground(new Color(160, 82, 45));
|
||||
loadCharacter.setFont(new Font("Bodoni 72 Oldstyle", Font.PLAIN, 23));
|
||||
loadCharacter.setBounds(376, 98, 233, 97);
|
||||
controlPanel.add(loadCharacter);
|
||||
return controlPanel;
|
||||
panel.add(subPanel);
|
||||
panel.add(loadCharacter);
|
||||
|
||||
return panel;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return
|
||||
*/
|
||||
private JLabel mainMenuLbl() {
|
||||
JLabel mainMenuLbl = new JLabel("Main Menu");
|
||||
mainMenuLbl.setFont(new Font("Bodoni 72 Smallcaps", Font.PLAIN, 33));
|
||||
mainMenuLbl.setHorizontalAlignment(SwingConstants.CENTER);
|
||||
return mainMenuLbl;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,21 +2,12 @@ package GUI.Panels;
|
||||
|
||||
import GUI.AppTheme;
|
||||
|
||||
import java.awt.BorderLayout;
|
||||
import java.awt.Color;
|
||||
import java.awt.Font;
|
||||
import java.awt.GridLayout;
|
||||
import javax.swing.*;
|
||||
import javax.swing.border.BevelBorder;
|
||||
import java.awt.*;
|
||||
import java.awt.event.ActionEvent;
|
||||
import java.awt.event.ActionListener;
|
||||
|
||||
import javax.swing.JButton;
|
||||
import javax.swing.JLabel;
|
||||
import javax.swing.JPanel;
|
||||
import javax.swing.SwingConstants;
|
||||
import javax.swing.border.BevelBorder;
|
||||
import javax.swing.JTextField;
|
||||
import javax.swing.JTextArea;
|
||||
|
||||
public class step4 extends JPanel implements AppTheme {
|
||||
private JTextField nameTxtField;
|
||||
private JTextField ageTextField;
|
||||
@@ -34,6 +25,7 @@ public class step4 extends JPanel implements AppTheme {
|
||||
|
||||
|
||||
}
|
||||
|
||||
private void createEntirePanel() {
|
||||
setBackground(new Color(222, 184, 135));
|
||||
setBorder(new BevelBorder(BevelBorder.RAISED, new Color(160, 82, 45), new Color(165, 42, 42), new Color(0, 0, 0), null));
|
||||
|
||||
@@ -52,13 +52,22 @@ public class DefaultButton extends JButton implements AppTheme {
|
||||
addMouseListener(
|
||||
new MouseListener() {
|
||||
@Override
|
||||
public void mouseClicked(MouseEvent e) {}
|
||||
public void mouseClicked(MouseEvent e) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void mousePressed(MouseEvent e) {}
|
||||
public void mousePressed(MouseEvent e) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void mouseReleased(MouseEvent e) {}
|
||||
public void mouseReleased(MouseEvent e) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void mouseEntered(MouseEvent e) { applyFocusedButtonStyle(); }
|
||||
public void mouseEntered(MouseEvent e) {
|
||||
applyFocusedButtonStyle();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void mouseExited(MouseEvent e) {
|
||||
|
||||
@@ -83,5 +92,4 @@ public class DefaultButton extends JButton implements AppTheme {
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -2,14 +2,9 @@ package Resources.CustomAssets;
|
||||
|
||||
import GUI.AppTheme;
|
||||
|
||||
import javax.imageio.ImageIO;
|
||||
import javax.swing.*;
|
||||
import javax.swing.border.EmptyBorder;
|
||||
import java.awt.*;
|
||||
import java.awt.image.BufferedImage;
|
||||
import java.io.File;
|
||||
import java.util.Objects;
|
||||
import java.util.Random;
|
||||
|
||||
public class InfoPanel extends JPanel implements AppTheme {
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
package Resources.CustomAssets;
|
||||
|
||||
import javax.swing.border.*;
|
||||
import javax.swing.border.Border;
|
||||
import java.awt.*;
|
||||
|
||||
public class RoundedBorder implements Border {
|
||||
|
||||
Reference in New Issue
Block a user