Refactoring DescriptionPanel code and logic, pending further refinement and layout.
This commit is contained in:
Generated
+1
-1
@@ -1,6 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<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_19" default="true" project-jdk-name="17" project-jdk-type="JavaSDK">
|
||||
<output url="file://$USER_HOME$/Desktop/dndApp" />
|
||||
</component>
|
||||
</project>
|
||||
@@ -22,6 +22,7 @@ public interface AppTheme {
|
||||
public Font subHeaderFont = new Font("SanSalvi", Font.PLAIN, 35);
|
||||
|
||||
public Font paragraphFont = new Font("SanSalvi", Font.PLAIN, 20);
|
||||
public Font userTextFont = new Font("SanSalvi", Font.PLAIN, 15);
|
||||
public Font buttonFont = new Font("SanSalvi", Font.PLAIN, 15);
|
||||
|
||||
public String OS = System.getProperty("os.name");
|
||||
|
||||
@@ -1,12 +1,11 @@
|
||||
package GUI;
|
||||
|
||||
import GUI.Panels.*;
|
||||
import GUI.Panels.SubPanels.NavPanel;
|
||||
import Resources.CustomAssets.BasicNavPanel;
|
||||
import Resources.CustomAssets.DefaultButton;
|
||||
|
||||
import javax.swing.*;
|
||||
import java.awt.*;
|
||||
import java.awt.event.*;
|
||||
|
||||
public class GUImanager extends JFrame {
|
||||
|
||||
@@ -25,6 +24,11 @@ public class GUImanager extends JFrame {
|
||||
|
||||
private String[] statOptions;
|
||||
private String[] statDescriptions;
|
||||
private String[] characteristics;
|
||||
private String[] alignmentOptions;
|
||||
private String[] alignmentDescriptions;
|
||||
private String[] backgroundOptions;
|
||||
private String[] backgroundDescriptions;
|
||||
private int[] selectedStats;
|
||||
|
||||
|
||||
@@ -37,10 +41,11 @@ public class GUImanager extends JFrame {
|
||||
new MainMenuPanel(),
|
||||
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(27), statOptions, statDescriptions, selectedStats, "Step 3: Choose Your Ability Scores"),
|
||||
new DescriptionPanel(createNavPanel(), characteristics, alignmentOptions, alignmentDescriptions, backgroundOptions, backgroundDescriptions, "Step 4: Describe your character")
|
||||
};
|
||||
|
||||
this.currentPanel = 3;
|
||||
this.currentPanel = 4;
|
||||
this.lastPanel = currentPanel - 1;
|
||||
this.nextPanel = currentPanel + 1;
|
||||
|
||||
@@ -69,7 +74,7 @@ public class GUImanager extends JFrame {
|
||||
setLayout(new BorderLayout());
|
||||
setPreferredSize(new Dimension(750,550));
|
||||
setSize(getPreferredSize());
|
||||
setResizable(false);
|
||||
// setResizable(false);
|
||||
setLocationRelativeTo(null);
|
||||
|
||||
try {
|
||||
@@ -157,28 +162,113 @@ public class GUImanager extends JFrame {
|
||||
|
||||
statDescriptions = new String[] {
|
||||
|
||||
"Strength is a thing.",
|
||||
"Dexterity is a thing",
|
||||
"Constitution is a thing",
|
||||
"Intelligence is a thing",
|
||||
"Wisdom is a thing",
|
||||
"Charisma is a thing"
|
||||
"Strength is a thing.",
|
||||
"Dexterity is a thing",
|
||||
"Constitution is a thing",
|
||||
"Intelligence is a thing",
|
||||
"Wisdom is a thing",
|
||||
"Charisma is a thing"
|
||||
|
||||
};
|
||||
|
||||
selectedStats = new int[] {8, 8, 8, 8, 8, 8};
|
||||
|
||||
}
|
||||
characteristics = new String[] {
|
||||
|
||||
private NavPanel createNavPanel() {
|
||||
"Name",
|
||||
"Age",
|
||||
"Height",
|
||||
"Weight",
|
||||
"Eyes",
|
||||
"Hair"
|
||||
|
||||
return new NavPanel(createBackButton(), createContinueButton(), 0);
|
||||
};
|
||||
|
||||
alignmentOptions = new String[] {
|
||||
|
||||
"Lawful Good",
|
||||
"Neutral Good",
|
||||
"Chaotic Good",
|
||||
"Lawful Neutral",
|
||||
"True Neutral",
|
||||
"Chaotic Neutral",
|
||||
"Lawful Evil",
|
||||
"Neutral Evil",
|
||||
"Chaotic Evil"
|
||||
|
||||
};
|
||||
|
||||
alignmentDescriptions = new String[] {
|
||||
|
||||
"LG - need description",
|
||||
"NG - need description",
|
||||
"cg - need description",
|
||||
"ln - need description",
|
||||
"tn - need description",
|
||||
"cn - need description",
|
||||
"le - need description",
|
||||
"ne - need description",
|
||||
"ce - need description"
|
||||
|
||||
};
|
||||
|
||||
backgroundOptions = new String[] {
|
||||
|
||||
"Acolyte",
|
||||
"Charlatan",
|
||||
"Criminal",
|
||||
"Entertainer",
|
||||
"Folk Hero",
|
||||
"Gladiator",
|
||||
"Guild Artisan",
|
||||
"Guild Merchant",
|
||||
"Hermit",
|
||||
"Knight",
|
||||
"Noble",
|
||||
"Outlander",
|
||||
"Pirate",
|
||||
"Sage",
|
||||
"Sailor",
|
||||
"Soldier",
|
||||
"Spy",
|
||||
"Urchin"
|
||||
|
||||
};
|
||||
|
||||
backgroundDescriptions = new String[] {
|
||||
|
||||
"Acolyte - need description",
|
||||
"Charlatan - need description",
|
||||
"Criminal - need description",
|
||||
"Entertainer - need description",
|
||||
"Folk Hero - need description",
|
||||
"Gladiator - need description",
|
||||
"Guild Artisan - need description",
|
||||
"Guild Merchant - need description",
|
||||
"Hermit - need description",
|
||||
"Knight - need description",
|
||||
"Noble - need description",
|
||||
"Outlander - need description",
|
||||
"Pirate - need description",
|
||||
"Sage - need description",
|
||||
"Sailor - need description",
|
||||
"Soldier - need description",
|
||||
"Spy - need description",
|
||||
"Urchin - need description"
|
||||
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
private NavPanel createNavPanel(int continueRequirement) {
|
||||
private BasicNavPanel createNavPanel() {
|
||||
|
||||
return new NavPanel(createBackButton(), createContinueButton(), continueRequirement);
|
||||
return new BasicNavPanel(createBackButton(), createContinueButton(), 0);
|
||||
|
||||
}
|
||||
|
||||
private BasicNavPanel createNavPanel(int continueRequirement) {
|
||||
|
||||
return new BasicNavPanel(createBackButton(), createContinueButton(), continueRequirement);
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -1,13 +1,11 @@
|
||||
package GUI.Panels;
|
||||
|
||||
import GUI.AppTheme;
|
||||
import GUI.Panels.SubPanels.*;
|
||||
import Resources.CustomAssets.*;
|
||||
|
||||
import java.awt.*;
|
||||
|
||||
import javax.swing.*;
|
||||
import javax.swing.border.*;
|
||||
|
||||
public class BasicPanel extends JPanel implements AppTheme {
|
||||
|
||||
|
||||
@@ -1,12 +1,11 @@
|
||||
package GUI.Panels;
|
||||
|
||||
import GUI.AppTheme;
|
||||
import GUI.Panels.SubPanels.InfoPanel;
|
||||
import GUI.Panels.SubPanels.NavPanel;
|
||||
import Resources.CustomAssets.InfoPanel;
|
||||
import Resources.CustomAssets.BasicNavPanel;
|
||||
import Resources.CustomAssets.DefaultButton;
|
||||
|
||||
import javax.swing.*;
|
||||
import javax.swing.border.EmptyBorder;
|
||||
import javax.swing.border.LineBorder;
|
||||
import java.awt.*;
|
||||
|
||||
@@ -16,11 +15,11 @@ public class ChooseAbilityScoresPanel extends JPanel implements AppTheme {
|
||||
private JLabel[] statLabels;
|
||||
private String[] statOptions;
|
||||
private InfoPanel infoPanel;
|
||||
private NavPanel navPanel;
|
||||
private BasicNavPanel basicNavPanel;
|
||||
private int[] selectedStats;
|
||||
private int selectedStatIndex;
|
||||
|
||||
public ChooseAbilityScoresPanel(NavPanel navPanel, String[] statOptions, String[] statDescriptions, int[] selectedStats, String panelTitle) {
|
||||
public ChooseAbilityScoresPanel(BasicNavPanel basicNavPanel, String[] statOptions, String[] statDescriptions, int[] selectedStats, String panelTitle) {
|
||||
|
||||
super();
|
||||
panelSetup();
|
||||
@@ -28,7 +27,7 @@ public class ChooseAbilityScoresPanel extends JPanel implements AppTheme {
|
||||
this.selectedStats = selectedStats;
|
||||
this.statInfoButtons = new DefaultButton[statOptions.length];
|
||||
statLabels = new JLabel[statOptions.length];
|
||||
this.navPanel = navPanel;
|
||||
this.basicNavPanel = basicNavPanel;
|
||||
|
||||
Rectangle[] abilityScoreBounds = {
|
||||
|
||||
@@ -42,7 +41,7 @@ public class ChooseAbilityScoresPanel extends JPanel implements AppTheme {
|
||||
infoPanel.updateInfo(0); // Default start with 0th element.
|
||||
|
||||
createMasterPanel(panelTitle);
|
||||
add(navPanel, BorderLayout.SOUTH);
|
||||
add(basicNavPanel, BorderLayout.SOUTH);
|
||||
|
||||
}
|
||||
|
||||
@@ -197,12 +196,12 @@ public class ChooseAbilityScoresPanel extends JPanel implements AppTheme {
|
||||
|
||||
}
|
||||
|
||||
if(navPanel.getContinueRequirement() - value >= 0) {
|
||||
if(basicNavPanel.getContinueRequirement() - value >= 0) {
|
||||
|
||||
selectedStats[statIndex]++;
|
||||
statLabels[statIndex].setText("" + selectedStats[statIndex]);
|
||||
|
||||
navPanel.decreaseContinueRequirement(value);
|
||||
basicNavPanel.decreaseContinueRequirement(value);
|
||||
|
||||
}
|
||||
|
||||
@@ -218,12 +217,12 @@ public class ChooseAbilityScoresPanel extends JPanel implements AppTheme {
|
||||
|
||||
}
|
||||
|
||||
if(navPanel.getContinueRequirement() + value <= 27) {
|
||||
if(basicNavPanel.getContinueRequirement() + value <= 27) {
|
||||
|
||||
selectedStats[statIndex]--;
|
||||
statLabels[statIndex].setText("" + selectedStats[statIndex]);
|
||||
|
||||
navPanel.increaseContinueRequirement(value);
|
||||
basicNavPanel.increaseContinueRequirement(value);
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,309 @@
|
||||
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;
|
||||
import javax.swing.border.LineBorder;
|
||||
import java.awt.*;
|
||||
|
||||
public class DescriptionPanel extends JPanel implements AppTheme {
|
||||
|
||||
private BasicNavPanel nav;
|
||||
private String[] characteristics;
|
||||
private String[] characteristicsHolder;
|
||||
private String[] alignmentOptions;
|
||||
private String[] alignmentDescriptions;
|
||||
private String[] backgroundOptions;
|
||||
private String[] backgroundDescriptions;
|
||||
private String userBackground;
|
||||
private DefaultButton[] alignmentButtons;
|
||||
private DefaultButton[] backgroundButtons;
|
||||
private int alignmentChoice;
|
||||
private int backgroundChoice;
|
||||
|
||||
|
||||
public DescriptionPanel(BasicNavPanel nav, String[] characteristics, String[] alignmentOptions, String[] alignmentDescriptions, String[] backgroundOptions, String[] backgroundDescriptions, String panelTitle) {
|
||||
|
||||
super();
|
||||
this.nav = nav;
|
||||
this.characteristics = characteristics;
|
||||
this.alignmentOptions = alignmentOptions;
|
||||
this.alignmentDescriptions = alignmentDescriptions;
|
||||
this.backgroundOptions = backgroundOptions;
|
||||
this.backgroundDescriptions = backgroundDescriptions;
|
||||
|
||||
panelSetup();
|
||||
|
||||
createPanel(panelTitle, nav);
|
||||
|
||||
}
|
||||
|
||||
public String[] getCharacteristics() {
|
||||
|
||||
return characteristics;
|
||||
|
||||
}
|
||||
|
||||
public int getAlignmentChoice() {
|
||||
|
||||
return alignmentChoice;
|
||||
|
||||
}
|
||||
|
||||
public int getBackgroundChoice() {
|
||||
|
||||
return backgroundChoice;
|
||||
|
||||
}
|
||||
|
||||
private void panelSetup() {
|
||||
|
||||
setBackground(lightBrown);
|
||||
setLayout(new BorderLayout(0, 0));
|
||||
|
||||
alignmentChoice = 0;
|
||||
backgroundChoice = 0;
|
||||
|
||||
alignmentButtons = new DefaultButton[alignmentOptions.length];
|
||||
backgroundButtons = new DefaultButton[backgroundOptions.length];
|
||||
|
||||
characteristicsHolder = new String[] {
|
||||
|
||||
"Name: ",
|
||||
"Age: ",
|
||||
"Height: ",
|
||||
"Weight: ",
|
||||
"Eyes: ",
|
||||
"Hair: "
|
||||
|
||||
};
|
||||
|
||||
userBackground = "";
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
private void createPanel(String panelTitle, BasicNavPanel nav) {
|
||||
|
||||
add(createPanelTitle(panelTitle), BorderLayout.NORTH);
|
||||
|
||||
add(createBodyPanel(), BorderLayout.CENTER);
|
||||
|
||||
add(nav, BorderLayout.SOUTH);
|
||||
|
||||
}
|
||||
|
||||
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));
|
||||
|
||||
return title;
|
||||
|
||||
}
|
||||
|
||||
private JPanel createBodyPanel() {
|
||||
|
||||
GridBagConstraints c = new GridBagConstraints();
|
||||
|
||||
JPanel bodyPanel = new JPanel(new GridBagLayout());
|
||||
bodyPanel.setOpaque(false);
|
||||
|
||||
bodyPanel.add(createNamePanel());
|
||||
bodyPanel.add(createFooterPanel());
|
||||
|
||||
return bodyPanel;
|
||||
|
||||
}
|
||||
|
||||
private JPanel createNamePanel() {
|
||||
|
||||
JPanel panel = new JPanel();
|
||||
panel.setBackground(medBrown);
|
||||
|
||||
for (int i = 0; i < characteristicsHolder.length; i++) {
|
||||
|
||||
panel.add(createField(i));
|
||||
|
||||
}
|
||||
|
||||
return panel;
|
||||
|
||||
}
|
||||
|
||||
private JPanel createField(int index) {
|
||||
|
||||
JPanel panel = new JPanel();
|
||||
panel.setOpaque(false);
|
||||
|
||||
JLabel label = new JLabel(characteristicsHolder[index]);
|
||||
label.setFont(paragraphFont);
|
||||
label.setOpaque(false);
|
||||
label.setForeground(darkestBrown);
|
||||
|
||||
JTextField field = new JTextField(10);
|
||||
field.setFont(paragraphFont);
|
||||
field.setBackground(lightBrown);
|
||||
field.setBorder(null);
|
||||
|
||||
panel.add(label);
|
||||
panel.add(field);
|
||||
|
||||
return panel;
|
||||
|
||||
}
|
||||
|
||||
private JPanel createFooterPanel() {
|
||||
|
||||
JPanel panel = new JPanel(new GridLayout(1, 3));
|
||||
panel.setOpaque(false);
|
||||
panel.add(createAlignmentPanel());
|
||||
panel.add(createBackgroundPanel());
|
||||
panel.add(createTextBoxPanel());
|
||||
|
||||
return panel;
|
||||
|
||||
}
|
||||
|
||||
private JPanel createAlignmentPanel() {
|
||||
|
||||
JPanel alignmentPanel = new JPanel(new BorderLayout(0, 0));
|
||||
alignmentPanel.setBorder(new EmptyBorder(5, 5, 5, 5));
|
||||
alignmentPanel.setOpaque(false);
|
||||
|
||||
JLabel backgroundLabel = new JLabel("Alignment");
|
||||
backgroundLabel.setForeground(darkestBrown);
|
||||
backgroundLabel.setFont(subHeaderFont);
|
||||
backgroundLabel.setHorizontalAlignment(SwingConstants.CENTER);
|
||||
|
||||
JPanel innerPanel = new JPanel(new GridLayout(9, 1));
|
||||
innerPanel.setOpaque(false);
|
||||
|
||||
for (int i = 0; i < alignmentOptions.length; i++) {
|
||||
|
||||
alignmentButtons[i] = createButton(alignmentOptions[i], false, i);
|
||||
innerPanel.add(alignmentButtons[i]);
|
||||
|
||||
if(i == 0) {
|
||||
|
||||
alignmentButtons[i].select();
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
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.setOpaque(false);
|
||||
|
||||
for (int i = 0; i < backgroundOptions.length; i++) {
|
||||
|
||||
backgroundButtons[i] = createButton(backgroundOptions[i], false, i);
|
||||
innerPanel.add(backgroundButtons[i]);
|
||||
|
||||
if(i == 0) {
|
||||
|
||||
backgroundButtons[i].select();
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
backgroundPanel.add(innerPanel);
|
||||
|
||||
return backgroundPanel;
|
||||
|
||||
}
|
||||
|
||||
private JPanel createTextBoxPanel() {
|
||||
|
||||
JPanel panel = new JPanel(new BorderLayout(0, 0));
|
||||
panel.setOpaque(false);
|
||||
|
||||
JLabel label = new JLabel("Enter a Description");
|
||||
label.setFont(paragraphFont);
|
||||
label.setOpaque(false);
|
||||
label.setForeground(darkestBrown);
|
||||
|
||||
JTextArea textArea = new JTextArea();
|
||||
textArea.setForeground(darkestBrown);
|
||||
textArea.setFont(userTextFont);
|
||||
textArea.setOpaque(false);
|
||||
textArea.setBorder(new LineBorder(darkestBrown, 3));
|
||||
|
||||
panel.add(label);
|
||||
panel.add(textArea);
|
||||
|
||||
return panel;
|
||||
|
||||
}
|
||||
|
||||
private void updateAlignmentButtons(int newIndex) {
|
||||
|
||||
alignmentButtons[alignmentChoice].deSelect();
|
||||
alignmentButtons[newIndex].select();
|
||||
|
||||
alignmentChoice = newIndex;
|
||||
|
||||
System.out.println("Updating alignment to index " + newIndex + ", " + alignmentOptions[newIndex]);
|
||||
|
||||
}
|
||||
|
||||
private void updateBackgroundButtons(int newIndex) {
|
||||
|
||||
backgroundButtons[backgroundChoice].deSelect();
|
||||
backgroundButtons[newIndex].select();
|
||||
|
||||
backgroundChoice = newIndex;
|
||||
|
||||
System.out.println("Updating background to index " + newIndex + ", " + backgroundOptions[newIndex]);
|
||||
|
||||
|
||||
}
|
||||
|
||||
private DefaultButton createButton(String name, boolean isAlignmentElseBackground, int index) {
|
||||
|
||||
DefaultButton button = new DefaultButton(name);
|
||||
|
||||
if (isAlignmentElseBackground) {
|
||||
|
||||
button.addActionListener(e -> updateAlignmentButtons(index));
|
||||
|
||||
} else {
|
||||
|
||||
button.addActionListener(e -> updateBackgroundButtons(index));
|
||||
|
||||
}
|
||||
|
||||
return button;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,289 @@
|
||||
package GUI.Panels;
|
||||
|
||||
import GUI.AppTheme;
|
||||
|
||||
import java.awt.BorderLayout;
|
||||
import java.awt.Color;
|
||||
import java.awt.Font;
|
||||
import java.awt.GridLayout;
|
||||
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;
|
||||
private JTextField heightTxtField;
|
||||
private JTextField weightTxtField;
|
||||
private JTextField skinTxtField;
|
||||
private JTextField eyesTxtField;
|
||||
private JTextField hairTxtField;
|
||||
|
||||
/**
|
||||
* Create the panel.
|
||||
*/
|
||||
public step4() {
|
||||
createEntirePanel();
|
||||
|
||||
|
||||
}
|
||||
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));
|
||||
setLayout(new BorderLayout(0, 0));
|
||||
|
||||
JLabel lblNewLabel = createLbl();
|
||||
add(lblNewLabel, BorderLayout.NORTH);
|
||||
//Creates back and continue panel
|
||||
JPanel backContPanel = createBackContinuePanel();
|
||||
add(backContPanel, BorderLayout.SOUTH);
|
||||
|
||||
JPanel innerPanel = new JPanel();
|
||||
innerPanel.setToolTipText("");
|
||||
innerPanel.setOpaque(false);
|
||||
add(innerPanel, BorderLayout.CENTER);
|
||||
innerPanel.setLayout(null);
|
||||
|
||||
JPanel nameAndAlignment = new JPanel();
|
||||
nameAndAlignment.setBorder(new BevelBorder(BevelBorder.LOWERED, null, null, null, null));
|
||||
nameAndAlignment.setBackground(new Color(210, 105, 30));
|
||||
nameAndAlignment.setBounds(6, 6, 306, 114);
|
||||
innerPanel.add(nameAndAlignment);
|
||||
nameAndAlignment.setLayout(null);
|
||||
|
||||
JLabel nameLbl = new JLabel("Character Name: ");
|
||||
nameLbl.setBounds(6, 6, 108, 16);
|
||||
nameAndAlignment.add(nameLbl);
|
||||
|
||||
nameTxtField = new JTextField();
|
||||
nameTxtField.setBounds(121, 1, 173, 26);
|
||||
nameAndAlignment.add(nameTxtField);
|
||||
nameTxtField.setColumns(10);
|
||||
|
||||
JLabel ageLbl = new JLabel("Age: ");
|
||||
ageLbl.setBounds(6, 34, 32, 16);
|
||||
nameAndAlignment.add(ageLbl);
|
||||
|
||||
ageTextField = new JTextField();
|
||||
ageTextField.setBounds(61, 34, 64, 21);
|
||||
nameAndAlignment.add(ageTextField);
|
||||
ageTextField.setColumns(10);
|
||||
|
||||
JLabel heightLbl = new JLabel("Height: ");
|
||||
heightLbl.setBounds(6, 62, 55, 16);
|
||||
nameAndAlignment.add(heightLbl);
|
||||
|
||||
heightTxtField = new JTextField();
|
||||
heightTxtField.setBounds(61, 57, 64, 26);
|
||||
nameAndAlignment.add(heightTxtField);
|
||||
heightTxtField.setColumns(10);
|
||||
|
||||
JLabel weightLbl = new JLabel("Weight:");
|
||||
weightLbl.setBounds(6, 90, 61, 16);
|
||||
nameAndAlignment.add(weightLbl);
|
||||
|
||||
weightTxtField = new JTextField();
|
||||
weightTxtField.setBounds(61, 85, 64, 26);
|
||||
nameAndAlignment.add(weightTxtField);
|
||||
weightTxtField.setColumns(10);
|
||||
|
||||
JLabel skinLbl = new JLabel("Skin: ");
|
||||
skinLbl.setBounds(131, 34, 35, 16);
|
||||
nameAndAlignment.add(skinLbl);
|
||||
|
||||
skinTxtField = new JTextField();
|
||||
skinTxtField.setBounds(165, 29, 130, 26);
|
||||
nameAndAlignment.add(skinTxtField);
|
||||
skinTxtField.setColumns(10);
|
||||
|
||||
JLabel eyesLbl = new JLabel("Eyes: ");
|
||||
eyesLbl.setBounds(130, 62, 42, 16);
|
||||
nameAndAlignment.add(eyesLbl);
|
||||
|
||||
eyesTxtField = new JTextField();
|
||||
eyesTxtField.setBounds(164, 57, 130, 26);
|
||||
nameAndAlignment.add(eyesTxtField);
|
||||
eyesTxtField.setColumns(10);
|
||||
|
||||
JLabel hairLbl = new JLabel("Hair: ");
|
||||
hairLbl.setBounds(127, 90, 39, 16);
|
||||
nameAndAlignment.add(hairLbl);
|
||||
|
||||
hairTxtField = new JTextField();
|
||||
hairTxtField.setBounds(164, 85, 130, 26);
|
||||
nameAndAlignment.add(hairTxtField);
|
||||
hairTxtField.setColumns(10);
|
||||
|
||||
JPanel alignmentPanel = new JPanel();
|
||||
alignmentPanel.setBorder(new BevelBorder(BevelBorder.LOWERED, null, null, null, null));
|
||||
alignmentPanel.setBackground(new Color(205, 133, 63));
|
||||
alignmentPanel.setBounds(324, 6, 396, 114);
|
||||
innerPanel.add(alignmentPanel);
|
||||
alignmentPanel.setLayout(new BorderLayout(0, 0));
|
||||
|
||||
JLabel alignmentLbl = new JLabel("Alignment");
|
||||
alignmentLbl.setFont(new Font("Lucida Grande", Font.PLAIN, 19));
|
||||
alignmentLbl.setHorizontalAlignment(SwingConstants.CENTER);
|
||||
alignmentPanel.add(alignmentLbl, BorderLayout.NORTH);
|
||||
|
||||
JPanel alignmentInnerPanel = new JPanel();
|
||||
alignmentInnerPanel.setOpaque(false);
|
||||
alignmentPanel.add(alignmentInnerPanel, BorderLayout.CENTER);
|
||||
alignmentInnerPanel.setLayout(new GridLayout(3, 3, 0, 0));
|
||||
|
||||
JButton btnLawfulGood = new JButton("Lawful Good");
|
||||
alignmentInnerPanel.add(btnLawfulGood);
|
||||
|
||||
JButton btnNuetralGood = new JButton("Neutral Good");
|
||||
alignmentInnerPanel.add(btnNuetralGood);
|
||||
|
||||
JButton btnChaoticGood = new JButton("Chaotic Good");
|
||||
alignmentInnerPanel.add(btnChaoticGood);
|
||||
|
||||
JButton btnLawfulNeutral = new JButton("Lawful Neutral");
|
||||
alignmentInnerPanel.add(btnLawfulNeutral);
|
||||
|
||||
JButton btnTrueNeutral = new JButton("True Neutral");
|
||||
alignmentInnerPanel.add(btnTrueNeutral);
|
||||
|
||||
JButton btnChaoticNeutral = new JButton("Chaotic Neutral");
|
||||
alignmentInnerPanel.add(btnChaoticNeutral);
|
||||
|
||||
JButton btnLawfulEvil = new JButton("Lawful Evil");
|
||||
alignmentInnerPanel.add(btnLawfulEvil);
|
||||
|
||||
JButton btnNeutralEvil = new JButton("Neutral Evil");
|
||||
alignmentInnerPanel.add(btnNeutralEvil);
|
||||
|
||||
JButton btnChaoticEvil = new JButton("Chaotic Evil");
|
||||
alignmentInnerPanel.add(btnChaoticEvil);
|
||||
|
||||
JPanel backgroundPanel = new JPanel();
|
||||
backgroundPanel.setBorder(new BevelBorder(BevelBorder.LOWERED, null, null, null, null));
|
||||
backgroundPanel.setBackground(new Color(210, 105, 30));
|
||||
backgroundPanel.setBounds(6, 132, 306, 264);
|
||||
innerPanel.add(backgroundPanel);
|
||||
backgroundPanel.setLayout(new BorderLayout(0, 0));
|
||||
|
||||
JLabel backgroundLbl = new JLabel("Background");
|
||||
backgroundLbl.setFont(new Font("Dialog", Font.PLAIN, 20));
|
||||
backgroundLbl.setHorizontalAlignment(SwingConstants.CENTER);
|
||||
backgroundPanel.add(backgroundLbl, BorderLayout.NORTH);
|
||||
|
||||
JPanel backgroundInnerPanel = new JPanel();
|
||||
backgroundInnerPanel.setOpaque(false);
|
||||
backgroundPanel.add(backgroundInnerPanel, BorderLayout.CENTER);
|
||||
backgroundInnerPanel.setLayout(new GridLayout(9, 2, 0, 0));
|
||||
|
||||
JButton btnAcolyte = new JButton("Acolyte");
|
||||
backgroundInnerPanel.add(btnAcolyte);
|
||||
|
||||
JButton btnCharlatan = new JButton("Charlatan");
|
||||
backgroundInnerPanel.add(btnCharlatan);
|
||||
|
||||
JButton btnCriminal = new JButton("Criminal");
|
||||
backgroundInnerPanel.add(btnCriminal);
|
||||
|
||||
JButton btnEntertainer = new JButton("Entertainer");
|
||||
backgroundInnerPanel.add(btnEntertainer);
|
||||
|
||||
JButton btnFolkHero = new JButton("Folk Hero");
|
||||
backgroundInnerPanel.add(btnFolkHero);
|
||||
|
||||
JButton btnGladiator = new JButton("Gladiator");
|
||||
backgroundInnerPanel.add(btnGladiator);
|
||||
|
||||
JButton btnGuildArtisan = new JButton("Guild Artisan");
|
||||
backgroundInnerPanel.add(btnGuildArtisan);
|
||||
|
||||
JButton btnGuildMerchant = new JButton("Guild Merchant");
|
||||
backgroundInnerPanel.add(btnGuildMerchant);
|
||||
|
||||
JButton btnHermit = new JButton("Hermit");
|
||||
backgroundInnerPanel.add(btnHermit);
|
||||
|
||||
JButton btnKnight = new JButton("Knight");
|
||||
backgroundInnerPanel.add(btnKnight);
|
||||
|
||||
JButton btnNoble = new JButton("Noble");
|
||||
backgroundInnerPanel.add(btnNoble);
|
||||
|
||||
JButton btnOutlander = new JButton("Outlander");
|
||||
backgroundInnerPanel.add(btnOutlander);
|
||||
|
||||
JButton btnPirate = new JButton("Pirate");
|
||||
backgroundInnerPanel.add(btnPirate);
|
||||
|
||||
JButton btnSage = new JButton("Sage");
|
||||
backgroundInnerPanel.add(btnSage);
|
||||
|
||||
JButton btnSailor = new JButton("Sailor");
|
||||
backgroundInnerPanel.add(btnSailor);
|
||||
|
||||
JButton btnSoldier = new JButton("Soldier");
|
||||
backgroundInnerPanel.add(btnSoldier);
|
||||
|
||||
JButton btnSpy = new JButton("Spy");
|
||||
backgroundInnerPanel.add(btnSpy);
|
||||
|
||||
JButton btnUrchin = new JButton("Urchin");
|
||||
backgroundInnerPanel.add(btnUrchin);
|
||||
|
||||
JPanel panel = new JPanel();
|
||||
panel.setBackground(new Color(205, 133, 63));
|
||||
panel.setBorder(new BevelBorder(BevelBorder.LOWERED, null, null, null, null));
|
||||
panel.setBounds(324, 132, 396, 264);
|
||||
panel.setLayout(new BorderLayout(0, 0));
|
||||
|
||||
JLabel lblDescription = new JLabel("Description");
|
||||
lblDescription.setFont(new Font("Lucida Grande", Font.PLAIN, 20));
|
||||
lblDescription.setHorizontalAlignment(SwingConstants.CENTER);
|
||||
|
||||
JTextArea textArea = new JTextArea();
|
||||
textArea.setBackground(new Color(238, 232, 170));
|
||||
|
||||
panel.add(lblDescription, BorderLayout.NORTH);
|
||||
panel.add(textArea, BorderLayout.CENTER);
|
||||
|
||||
innerPanel.add(panel);
|
||||
|
||||
}
|
||||
|
||||
private JPanel createBackContinuePanel() {
|
||||
JPanel backContPanel = new JPanel();
|
||||
backContPanel.setBackground(new Color(205, 133, 63));
|
||||
|
||||
|
||||
JButton backBtn = new JButton("<--- Back ");
|
||||
backBtn.addActionListener(new ActionListener() {
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
}
|
||||
});
|
||||
backContPanel.add(backBtn);
|
||||
|
||||
JButton continueBtn = new JButton("Continue --->");
|
||||
continueBtn.addActionListener(new ActionListener() {
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
}
|
||||
});
|
||||
backContPanel.add(continueBtn);
|
||||
return backContPanel;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return
|
||||
*/
|
||||
private JLabel createLbl() {
|
||||
JLabel titleLbl = new JLabel("Step 4: Description");
|
||||
titleLbl.setHorizontalAlignment(SwingConstants.CENTER);
|
||||
titleLbl.setFont(new Font("Bodoni 72 Oldstyle", Font.PLAIN, 33));
|
||||
return titleLbl;
|
||||
}
|
||||
}
|
||||
+3
-5
@@ -1,21 +1,19 @@
|
||||
package GUI.Panels.SubPanels;
|
||||
package Resources.CustomAssets;
|
||||
|
||||
import GUI.AppTheme;
|
||||
import Resources.CustomAssets.DefaultButton;
|
||||
|
||||
import javax.sound.sampled.Line;
|
||||
import javax.swing.*;
|
||||
import javax.swing.border.EmptyBorder;
|
||||
import javax.swing.border.LineBorder;
|
||||
import java.awt.*;
|
||||
|
||||
public class NavPanel extends JPanel implements AppTheme {
|
||||
public class BasicNavPanel extends JPanel implements AppTheme {
|
||||
|
||||
private DefaultButton backButton;
|
||||
private DefaultButton continueButton;
|
||||
private int continueRequirement;
|
||||
|
||||
public NavPanel(DefaultButton backButton, DefaultButton continueButton, int continueRequirement) {
|
||||
public BasicNavPanel(DefaultButton backButton, DefaultButton continueButton, int continueRequirement) {
|
||||
|
||||
super(new GridLayout(1, 2, 30, 0));
|
||||
this.backButton = backButton;
|
||||
@@ -0,0 +1,14 @@
|
||||
package Resources.CustomAssets;
|
||||
|
||||
import java.awt.*;
|
||||
|
||||
public interface CustomTheme {
|
||||
|
||||
public Color background = null;
|
||||
public Color foreground = null;
|
||||
|
||||
Color getBackground();
|
||||
|
||||
Color getForeground();
|
||||
|
||||
}
|
||||
+1
-2
@@ -1,7 +1,6 @@
|
||||
package GUI.Panels.SubPanels;
|
||||
package Resources.CustomAssets;
|
||||
|
||||
import GUI.AppTheme;
|
||||
import org.w3c.dom.css.Rect;
|
||||
|
||||
import javax.imageio.ImageIO;
|
||||
import javax.swing.*;
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
package GUI.Panels.SubPanels;
|
||||
package Resources.CustomAssets;
|
||||
|
||||
import GUI.AppTheme;
|
||||
|
||||
Reference in New Issue
Block a user