added forward/previous page logic to GUI
This commit is contained in:
@@ -1,6 +1,7 @@
|
|||||||
package Character;
|
package Character;
|
||||||
|
|
||||||
import Character.AbilityScores.CharacterStats;
|
import Character.AbilityScores.CharacterStats;
|
||||||
|
import Character.Classes.ClassTemplate;
|
||||||
import Character.Races.*;
|
import Character.Races.*;
|
||||||
|
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
@@ -14,6 +15,7 @@ public class CharacterSheet implements Serializable {
|
|||||||
private String eye;
|
private String eye;
|
||||||
private String hair;
|
private String hair;
|
||||||
private Race race;
|
private Race race;
|
||||||
|
|
||||||
private CharacterStats stats;
|
private CharacterStats stats;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -4,35 +4,35 @@ import Character.AbilityScores.*;
|
|||||||
|
|
||||||
public interface ClassTemplate {
|
public interface ClassTemplate {
|
||||||
|
|
||||||
String getDescription();
|
abstract String getDescription();
|
||||||
|
|
||||||
String[] getProgression();
|
abstract String[] getProgression();
|
||||||
|
|
||||||
String[] getClassFeatures();
|
abstract String[] getClassFeatures();
|
||||||
|
|
||||||
String getHitDie();
|
abstract String getHitDie();
|
||||||
|
|
||||||
int getHPatLv1();
|
abstract int getHPatLv1();
|
||||||
|
|
||||||
int getHPpastLv1();
|
abstract int getHPpastLv1();
|
||||||
|
|
||||||
String[] getArmorProf();
|
abstract String[] getArmorProf();
|
||||||
|
|
||||||
String[] getWeaponProf();
|
abstract String[] getWeaponProf();
|
||||||
|
|
||||||
String[] getToolProf();
|
abstract String[] getToolProf();
|
||||||
|
|
||||||
String[] getSavingThrows();
|
abstract String[] getSavingThrows();
|
||||||
|
|
||||||
// TODO: Need to refresh on how saving throws work and how the character's class may impact a saving throw.
|
// TODO: Need to refresh on how saving throws work and how the character's class may impact a saving throw.
|
||||||
|
|
||||||
String[] availableSkills();
|
abstract String[] availableSkills();
|
||||||
|
|
||||||
String[] startingEquipChoices();
|
abstract String[] startingEquipChoices();
|
||||||
|
|
||||||
boolean advantageCheck(Stats abilityScore);
|
abstract boolean advantageCheck(Stats abilityScore);
|
||||||
|
|
||||||
boolean disadvantageCheck(Stats abilityScore);
|
abstract boolean disadvantageCheck(Stats abilityScore);
|
||||||
|
|
||||||
// TODO: Spells and shit.
|
// TODO: Spells and shit.
|
||||||
|
|
||||||
|
|||||||
@@ -1,9 +1,6 @@
|
|||||||
package GUI;
|
package GUI;
|
||||||
|
|
||||||
import GUI.Panels.AbilityScorePanel;
|
import GUI.Panels.*;
|
||||||
import GUI.Panels.ChooseClassPanel;
|
|
||||||
import GUI.Panels.ChooseRacePanel;
|
|
||||||
import GUI.Panels.MainMenuPanel;
|
|
||||||
|
|
||||||
import javax.swing.*;
|
import javax.swing.*;
|
||||||
import java.awt.*;
|
import java.awt.*;
|
||||||
@@ -37,7 +34,12 @@ public class GUImanager extends JFrame {
|
|||||||
public GUImanager (boolean returningUser) {
|
public GUImanager (boolean returningUser) {
|
||||||
super("D&D Character Builder");
|
super("D&D Character Builder");
|
||||||
frameSetup();
|
frameSetup();
|
||||||
this.panels = new JPanel[]{new MainMenuPanel(), new ChooseRacePanel(), new ChooseClassPanel(), new AbilityScorePanel()};
|
this.panels = new JPanel[]{
|
||||||
|
new MainMenuPanel(),
|
||||||
|
new ChooseRacePanel(createBackButton(), createContinueButton()),
|
||||||
|
new ChooseClassPanel(createBackButton(),createContinueButton()),
|
||||||
|
new ChooseAbilityScoresPanel(createBackButton(), createContinueButton())
|
||||||
|
};
|
||||||
|
|
||||||
this.lastPanel = 0;
|
this.lastPanel = 0;
|
||||||
this.currentPanel = 1;
|
this.currentPanel = 1;
|
||||||
@@ -60,7 +62,7 @@ public class GUImanager extends JFrame {
|
|||||||
|
|
||||||
setDefaultCloseOperation(EXIT_ON_CLOSE);
|
setDefaultCloseOperation(EXIT_ON_CLOSE);
|
||||||
setLayout(new BorderLayout());
|
setLayout(new BorderLayout());
|
||||||
setPreferredSize(new Dimension(600,600));
|
setPreferredSize(new Dimension(735,550));
|
||||||
setSize(getPreferredSize());
|
setSize(getPreferredSize());
|
||||||
|
|
||||||
try {
|
try {
|
||||||
@@ -80,9 +82,11 @@ public class GUImanager extends JFrame {
|
|||||||
navigationContainer.add(createBackButton());
|
navigationContainer.add(createBackButton());
|
||||||
navigationContainer.add(createContinueButton());
|
navigationContainer.add(createContinueButton());
|
||||||
|
|
||||||
masterPanel.add(navigationContainer);
|
//masterPanel.add(navigationContainer);
|
||||||
|
|
||||||
return masterPanel;
|
// return masterPanel;
|
||||||
|
|
||||||
|
return panels[currentPanel];
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -94,6 +98,7 @@ public class GUImanager extends JFrame {
|
|||||||
new ActionListener() {
|
new ActionListener() {
|
||||||
@Override
|
@Override
|
||||||
public void actionPerformed(ActionEvent e) {
|
public void actionPerformed(ActionEvent e) {
|
||||||
|
System.out.println("Back button registered.");
|
||||||
|
|
||||||
lastPanel--;
|
lastPanel--;
|
||||||
currentPanel--;
|
currentPanel--;
|
||||||
@@ -117,7 +122,7 @@ public class GUImanager extends JFrame {
|
|||||||
new ActionListener() {
|
new ActionListener() {
|
||||||
@Override
|
@Override
|
||||||
public void actionPerformed(ActionEvent e) {
|
public void actionPerformed(ActionEvent e) {
|
||||||
|
System.out.println("Continue button registered.");
|
||||||
lastPanel++;
|
lastPanel++;
|
||||||
currentPanel++;
|
currentPanel++;
|
||||||
nextPanel++;
|
nextPanel++;
|
||||||
|
|||||||
@@ -1,122 +0,0 @@
|
|||||||
package GUI.Panels;
|
|
||||||
|
|
||||||
import javax.swing.*;
|
|
||||||
import java.awt.*;
|
|
||||||
import java.awt.event.ActionEvent;
|
|
||||||
import java.awt.event.ActionListener;
|
|
||||||
|
|
||||||
public class AbilityScorePanel extends JPanel {
|
|
||||||
|
|
||||||
private JPanel[] statsPanels;
|
|
||||||
private int[] stats;
|
|
||||||
private String[] statNames;
|
|
||||||
private int currentIndex;
|
|
||||||
|
|
||||||
public AbilityScorePanel() {
|
|
||||||
|
|
||||||
super();
|
|
||||||
stats = new int[] {8,8,8,8,8,8};
|
|
||||||
statNames = new String[]{"Strength", "Dexterity", "Constitution", "Intelligence", "Wisdom", "Charisma"};
|
|
||||||
statsPanels = new JPanel[6];
|
|
||||||
|
|
||||||
for (int i = 0; i < statNames.length; i++) {
|
|
||||||
|
|
||||||
statsPanels[i] = createStatPanel(statNames[i], i);
|
|
||||||
|
|
||||||
}
|
|
||||||
createMasterPanel();
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
private void createMasterPanel() {
|
|
||||||
|
|
||||||
setLayout(new BorderLayout(0, 0));
|
|
||||||
|
|
||||||
JPanel masterPanel = new JPanel();
|
|
||||||
|
|
||||||
JLabel title = new JLabel("Step 3: Choose Ability Scores");
|
|
||||||
|
|
||||||
JPanel scoreHolder = new JPanel(new GridLayout(3, 2, 15, 15));
|
|
||||||
for (int i = 0; i < statNames.length; i++) {
|
|
||||||
|
|
||||||
scoreHolder.add(statsPanels[i]);
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
masterPanel.add(title);
|
|
||||||
masterPanel.add(scoreHolder);
|
|
||||||
|
|
||||||
add(masterPanel);
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
private JPanel createStatPanel(String statName, int currentIndex) {
|
|
||||||
|
|
||||||
JPanel container = new JPanel();
|
|
||||||
container.add(createMinusButton(currentIndex));
|
|
||||||
|
|
||||||
JPanel textHolder = new JPanel(new GridLayout(2, 1, 15, 15));
|
|
||||||
textHolder.add(new JLabel(statName));
|
|
||||||
textHolder.add(new JLabel(Integer.toString(stats[currentIndex])));
|
|
||||||
container.add(textHolder);
|
|
||||||
container.add(createPlusButton(currentIndex));
|
|
||||||
|
|
||||||
return container;
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
private void refreshStatPanel(int currentIndex) {
|
|
||||||
|
|
||||||
statsPanels[currentIndex].removeAll();
|
|
||||||
statsPanels[currentIndex] = createStatPanel(statNames[currentIndex], currentIndex);
|
|
||||||
|
|
||||||
revalidate();
|
|
||||||
repaint();
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
private JButton createMinusButton(int currentIndex) {
|
|
||||||
|
|
||||||
JButton button = new JButton("-");
|
|
||||||
button.addActionListener(
|
|
||||||
|
|
||||||
new ActionListener() {
|
|
||||||
@Override
|
|
||||||
public void actionPerformed(ActionEvent e) {
|
|
||||||
|
|
||||||
stats[currentIndex]--;
|
|
||||||
refreshStatPanel(currentIndex);
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
);
|
|
||||||
|
|
||||||
return button;
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
// TODO: Need to refactor into increment and decrement score methods, as the number of points required to purchase an increase rises.
|
|
||||||
private JButton createPlusButton(int currentIndex) {
|
|
||||||
|
|
||||||
JButton button = new JButton("+");
|
|
||||||
button.addActionListener(
|
|
||||||
|
|
||||||
new ActionListener() {
|
|
||||||
@Override
|
|
||||||
public void actionPerformed(ActionEvent e) {
|
|
||||||
|
|
||||||
stats[currentIndex]++;
|
|
||||||
refreshStatPanel(currentIndex);
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
);
|
|
||||||
|
|
||||||
return button;
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
+12
-16
@@ -13,28 +13,22 @@ import javax.swing.SwingConstants;
|
|||||||
import javax.swing.border.BevelBorder;
|
import javax.swing.border.BevelBorder;
|
||||||
import javax.swing.JTextPane;
|
import javax.swing.JTextPane;
|
||||||
import java.awt.GridLayout;
|
import java.awt.GridLayout;
|
||||||
import javax.swing.border.EmptyBorder;
|
|
||||||
import javax.swing.border.LineBorder;
|
import javax.swing.border.LineBorder;
|
||||||
import javax.swing.border.CompoundBorder;
|
|
||||||
import javax.swing.border.EtchedBorder;
|
|
||||||
import javax.swing.border.MatteBorder;
|
|
||||||
import javax.swing.border.SoftBevelBorder;
|
|
||||||
import javax.swing.border.TitledBorder;
|
|
||||||
|
|
||||||
public class step3 extends JPanel {
|
public class ChooseAbilityScoresPanel extends JPanel {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create the panel.
|
* Create the panel.
|
||||||
*/
|
*/
|
||||||
public step3() {
|
public ChooseAbilityScoresPanel(JButton backButton, JButton continueButton) {
|
||||||
createEntirePanel();
|
createEntirePanel(backButton, continueButton);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
private void createEntirePanel() {
|
private void createEntirePanel(JButton backButton, JButton continueButton) {
|
||||||
setBackground(new Color(222, 184, 135));
|
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));
|
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));
|
setLayout(new BorderLayout(0, 0));
|
||||||
@@ -42,7 +36,7 @@ public class step3 extends JPanel {
|
|||||||
JLabel lblNewLabel = createLbl();
|
JLabel lblNewLabel = createLbl();
|
||||||
add(lblNewLabel, BorderLayout.NORTH);
|
add(lblNewLabel, BorderLayout.NORTH);
|
||||||
//Creates back and continue panel
|
//Creates back and continue panel
|
||||||
JPanel backContPanel = createBackContinuePanel();
|
JPanel backContPanel = createBackContinuePanel(backButton, continueButton);
|
||||||
add(backContPanel, BorderLayout.SOUTH);
|
add(backContPanel, BorderLayout.SOUTH);
|
||||||
|
|
||||||
JPanel innerPanel = createInnerPanel();
|
JPanel innerPanel = createInnerPanel();
|
||||||
@@ -214,24 +208,26 @@ public class step3 extends JPanel {
|
|||||||
diceRollerPanel.add(d6lbl4);
|
diceRollerPanel.add(d6lbl4);
|
||||||
}
|
}
|
||||||
|
|
||||||
private JPanel createBackContinuePanel() {
|
private JPanel createBackContinuePanel(JButton backButton, JButton continueButton) {
|
||||||
JPanel backContPanel = new JPanel();
|
JPanel backContPanel = new JPanel();
|
||||||
backContPanel.setBackground(new Color(205, 133, 63));
|
backContPanel.setBackground(new Color(205, 133, 63));
|
||||||
|
|
||||||
|
|
||||||
JButton backBtn = new JButton("<--- Back ");
|
/* JButton backBtn = new JButton("<--- Back ");
|
||||||
backBtn.addActionListener(new ActionListener() {
|
backBtn.addActionListener(new ActionListener() {
|
||||||
public void actionPerformed(ActionEvent e) {
|
public void actionPerformed(ActionEvent e) {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
backContPanel.add(backBtn);
|
backContPanel.add(backBtn);*/
|
||||||
|
backContPanel.add(backButton);
|
||||||
|
|
||||||
JButton continueBtn = new JButton("Continue --->");
|
/* JButton continueBtn = new JButton("Continue --->");
|
||||||
continueBtn.addActionListener(new ActionListener() {
|
continueBtn.addActionListener(new ActionListener() {
|
||||||
public void actionPerformed(ActionEvent e) {
|
public void actionPerformed(ActionEvent e) {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
backContPanel.add(continueBtn);
|
backContPanel.add(continueBtn);*/
|
||||||
|
backContPanel.add(continueButton);
|
||||||
return backContPanel;
|
return backContPanel;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1,79 +1,203 @@
|
|||||||
package GUI.Panels;
|
package GUI.Panels;
|
||||||
|
|
||||||
import javax.swing.*;
|
import java.awt.BorderLayout;
|
||||||
import java.awt.*;
|
import java.awt.Color;
|
||||||
import java.awt.event.*;
|
import java.awt.Font;
|
||||||
|
import java.awt.event.ActionEvent;
|
||||||
|
import java.awt.event.ActionListener;
|
||||||
|
|
||||||
|
import javax.swing.JPanel;
|
||||||
|
import javax.swing.JTextPane;
|
||||||
|
import javax.swing.SwingConstants;
|
||||||
|
import javax.swing.border.BevelBorder;
|
||||||
|
import javax.swing.JButton;
|
||||||
|
import javax.swing.JLabel;
|
||||||
|
|
||||||
public class ChooseClassPanel extends JPanel {
|
public class ChooseClassPanel extends JPanel {
|
||||||
|
|
||||||
private String classChoice;
|
/**
|
||||||
private boolean ableToContinue;
|
* Create the panel.
|
||||||
|
*/
|
||||||
public ChooseClassPanel() {
|
public ChooseClassPanel(JButton backButton, JButton contButton) {
|
||||||
|
setBackground(new Color(222, 184, 135));
|
||||||
super();
|
setBorder(new BevelBorder(BevelBorder.RAISED, new Color(160, 82, 45), new Color(165, 42, 42), new Color(0, 0, 0), null));
|
||||||
createMasterPanel();
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
private void createMasterPanel() {
|
|
||||||
|
|
||||||
setLayout(new BorderLayout(0, 0));
|
setLayout(new BorderLayout(0, 0));
|
||||||
|
|
||||||
JPanel masterPanel = new JPanel();
|
JLabel lblNewLabel = createLbl();
|
||||||
|
add(lblNewLabel, BorderLayout.NORTH);
|
||||||
|
//Creates back and continue panel
|
||||||
|
JPanel backContPanel = createBackContinuePanel(backButton, contButton);
|
||||||
|
add(backContPanel, BorderLayout.SOUTH);
|
||||||
|
|
||||||
JLabel title = new JLabel("Step 2: Choose Class");
|
JPanel innerPanel = new JPanel();
|
||||||
title.setHorizontalAlignment(SwingConstants.CENTER);
|
innerPanel.setOpaque(false);
|
||||||
masterPanel.add(title, BorderLayout.NORTH);
|
innerPanel.setLayout(null);
|
||||||
|
|
||||||
JPanel classContainer = new JPanel();
|
JPanel infoPanel = createInfoPanel();
|
||||||
|
innerPanel.add(infoPanel);
|
||||||
|
|
||||||
String[] availableClasses = {"Cleric", "Fighter", "Wizard"};
|
JPanel btnPanel = createBtnPanel();
|
||||||
|
innerPanel.add(btnPanel);
|
||||||
for (int i = 0; i < availableClasses.length; i++) {
|
|
||||||
|
|
||||||
classContainer.add(createButton(availableClasses[i]));
|
|
||||||
|
|
||||||
|
add(innerPanel, BorderLayout.CENTER);
|
||||||
}
|
}
|
||||||
|
|
||||||
masterPanel.add(classContainer);
|
private JPanel createBtnPanel() {
|
||||||
|
JPanel btnPanel = new JPanel();
|
||||||
|
btnPanel.setBackground(new Color(165, 42, 42));
|
||||||
|
btnPanel.setBorder(new BevelBorder(BevelBorder.LOWERED, null, null, null, null));
|
||||||
|
btnPanel.setBounds(311, 6, 409, 394);
|
||||||
|
|
||||||
add(masterPanel);
|
JButton artificerBtn = new JButton("Artificer");
|
||||||
|
artificerBtn.addActionListener(new ActionListener() {
|
||||||
}
|
|
||||||
|
|
||||||
private JButton createButton(String userChoice) {
|
|
||||||
|
|
||||||
JButton button = new JButton(userChoice);
|
|
||||||
|
|
||||||
button.addActionListener(
|
|
||||||
|
|
||||||
new ActionListener() {
|
|
||||||
@Override
|
|
||||||
public void actionPerformed(ActionEvent e) {
|
public void actionPerformed(ActionEvent e) {
|
||||||
|
|
||||||
System.out.println(userChoice);
|
|
||||||
classChoice = userChoice;
|
|
||||||
ableToContinue = true;
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
});
|
||||||
|
btnPanel.add(artificerBtn);
|
||||||
|
|
||||||
|
JButton barbarianBtn = new JButton("Barbarian");
|
||||||
|
barbarianBtn.addActionListener(new ActionListener() {
|
||||||
|
public void actionPerformed(ActionEvent e) {
|
||||||
|
}
|
||||||
|
});
|
||||||
|
btnPanel.add(barbarianBtn);
|
||||||
|
|
||||||
|
JButton bardBtn = new JButton("Bard");
|
||||||
|
bardBtn.addActionListener(new ActionListener() {
|
||||||
|
public void actionPerformed(ActionEvent e) {
|
||||||
|
}
|
||||||
|
});
|
||||||
|
btnPanel.add(bardBtn);
|
||||||
|
|
||||||
|
JButton clericBtn = new JButton("Cleric");
|
||||||
|
clericBtn.addActionListener(new ActionListener() {
|
||||||
|
public void actionPerformed(ActionEvent e) {
|
||||||
|
}
|
||||||
|
});
|
||||||
|
btnPanel.add(clericBtn);
|
||||||
|
|
||||||
|
JButton druidBtn = new JButton("Druid");
|
||||||
|
druidBtn.addActionListener(new ActionListener() {
|
||||||
|
public void actionPerformed(ActionEvent e) {
|
||||||
|
}
|
||||||
|
});
|
||||||
|
btnPanel.add(druidBtn);
|
||||||
|
|
||||||
|
JButton fighterBtn = new JButton("Figther");
|
||||||
|
fighterBtn.addActionListener(new ActionListener() {
|
||||||
|
public void actionPerformed(ActionEvent e) {
|
||||||
|
}
|
||||||
|
});
|
||||||
|
btnPanel.add(fighterBtn);
|
||||||
|
|
||||||
|
JButton monkBtn = new JButton("Monk");
|
||||||
|
monkBtn.addActionListener(new ActionListener() {
|
||||||
|
public void actionPerformed(ActionEvent e) {
|
||||||
|
}
|
||||||
|
});
|
||||||
|
btnPanel.add(monkBtn);
|
||||||
|
|
||||||
|
JButton paladinBtn = new JButton("Paladin");
|
||||||
|
paladinBtn.addActionListener(new ActionListener() {
|
||||||
|
public void actionPerformed(ActionEvent e) {
|
||||||
|
}
|
||||||
|
});
|
||||||
|
btnPanel.add(paladinBtn);
|
||||||
|
|
||||||
|
JButton rangerBtn = new JButton("Ranger");
|
||||||
|
rangerBtn.addActionListener(new ActionListener() {
|
||||||
|
public void actionPerformed(ActionEvent e) {
|
||||||
|
}
|
||||||
|
});
|
||||||
|
btnPanel.add(rangerBtn);
|
||||||
|
|
||||||
|
JButton rogueBtn = new JButton("Rogue");
|
||||||
|
rogueBtn.addActionListener(new ActionListener() {
|
||||||
|
public void actionPerformed(ActionEvent e) {
|
||||||
|
}
|
||||||
|
});
|
||||||
|
btnPanel.add(rogueBtn);
|
||||||
|
|
||||||
|
JButton sorcererBtn = new JButton("Sorcerer");
|
||||||
|
sorcererBtn.addActionListener(new ActionListener() {
|
||||||
|
public void actionPerformed(ActionEvent e) {
|
||||||
|
}
|
||||||
|
});
|
||||||
|
btnPanel.add(sorcererBtn);
|
||||||
|
|
||||||
|
JButton warlockBtn = new JButton("Warlock");
|
||||||
|
warlockBtn.addActionListener(new ActionListener() {
|
||||||
|
public void actionPerformed(ActionEvent e) {
|
||||||
|
}
|
||||||
|
});
|
||||||
|
btnPanel.add(warlockBtn);
|
||||||
|
|
||||||
|
JButton wizardBtn = new JButton("Wizard");
|
||||||
|
wizardBtn.addActionListener(new ActionListener() {
|
||||||
|
public void actionPerformed(ActionEvent e) {
|
||||||
|
}
|
||||||
|
});
|
||||||
|
btnPanel.add(wizardBtn);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
return btnPanel;
|
||||||
}
|
}
|
||||||
|
|
||||||
);
|
private JPanel createInfoPanel() {
|
||||||
|
JPanel infoPanel = new JPanel();
|
||||||
|
infoPanel.setOpaque(false);
|
||||||
|
infoPanel.setBorder(new BevelBorder(BevelBorder.LOWERED, null, null, null, null));
|
||||||
|
infoPanel.setBounds(6, 6, 293, 394);
|
||||||
|
infoPanel.setLayout(null);
|
||||||
|
|
||||||
return button;
|
JLabel infoLbl = new JLabel("Information");
|
||||||
|
infoLbl.setFont(new Font("Bodoni 72", Font.PLAIN, 20));
|
||||||
|
infoLbl.setHorizontalAlignment(SwingConstants.CENTER);
|
||||||
|
infoLbl.setBounds(92, 6, 105, 16);
|
||||||
|
infoPanel.add(infoLbl);
|
||||||
|
|
||||||
|
JTextPane infoTextPane = new JTextPane();
|
||||||
|
infoTextPane.setOpaque(false);
|
||||||
|
infoTextPane.setBounds(6, 21, 281, 367);
|
||||||
|
infoPanel.add(infoTextPane);
|
||||||
|
return infoPanel;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getClassChoice() {
|
/**
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
private JPanel createBackContinuePanel(JButton backButton, JButton continueButton) {
|
||||||
|
JPanel backContPanel = new JPanel();
|
||||||
|
backContPanel.setBackground(new Color(205, 133, 63));
|
||||||
|
|
||||||
return classChoice;
|
|
||||||
|
|
||||||
|
JButton backBtn = new JButton("<--- Back ");
|
||||||
|
backBtn.addActionListener(new ActionListener() {
|
||||||
|
public void actionPerformed(ActionEvent e) {
|
||||||
|
}
|
||||||
|
});
|
||||||
|
// backContPanel.add(backBtn);
|
||||||
|
backContPanel.add(backButton);
|
||||||
|
|
||||||
|
JButton continueBtn = new JButton("Continue --->");
|
||||||
|
continueBtn.addActionListener(new ActionListener() {
|
||||||
|
public void actionPerformed(ActionEvent e) {
|
||||||
|
}
|
||||||
|
});
|
||||||
|
// backContPanel.add(continueBtn);
|
||||||
|
backContPanel.add(continueButton);
|
||||||
|
return backContPanel;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isAbleToContinue() {
|
/**
|
||||||
|
* @return
|
||||||
return ableToContinue;
|
*/
|
||||||
|
private JLabel createLbl() {
|
||||||
|
JLabel lblNewLabel = new JLabel("Step 2: Choose Class");
|
||||||
|
lblNewLabel.setHorizontalAlignment(SwingConstants.CENTER);
|
||||||
|
lblNewLabel.setFont(new Font("Bodoni 72 Oldstyle", Font.PLAIN, 33));
|
||||||
|
return lblNewLabel;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|||||||
@@ -1,83 +1,67 @@
|
|||||||
package GUI.Panels;
|
package GUI.Panels;
|
||||||
|
|
||||||
import javax.swing.*;
|
|
||||||
import java.awt.BorderLayout;
|
import java.awt.BorderLayout;
|
||||||
import java.awt.GridLayout;
|
import java.awt.Color;
|
||||||
|
import java.awt.Font;
|
||||||
import java.awt.event.ActionEvent;
|
import java.awt.event.ActionEvent;
|
||||||
import java.awt.event.ActionListener;
|
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.JTextPane;
|
||||||
|
|
||||||
public class ChooseRacePanel extends JPanel {
|
public class ChooseRacePanel extends JPanel {
|
||||||
|
|
||||||
private String raceChoice;
|
/**
|
||||||
private boolean ableToContinue;
|
* Create the panel.
|
||||||
|
*/
|
||||||
|
public ChooseRacePanel(JButton backButton, JButton continueButton) {
|
||||||
public ChooseRacePanel() {
|
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));
|
||||||
super();
|
|
||||||
createMasterPanel();
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
private void createMasterPanel() {
|
|
||||||
|
|
||||||
setLayout(new BorderLayout(0, 0));
|
setLayout(new BorderLayout(0, 0));
|
||||||
|
|
||||||
JPanel masterPanel = new JPanel();
|
JLabel lblNewLabel = new JLabel("Step 1: Choose Race");
|
||||||
|
lblNewLabel.setHorizontalAlignment(SwingConstants.CENTER);
|
||||||
|
lblNewLabel.setFont(new Font("Bodoni 72 Oldstyle", Font.PLAIN, 33));
|
||||||
|
add(lblNewLabel, BorderLayout.NORTH);
|
||||||
|
|
||||||
JLabel title = new JLabel("Step 1: Choose Race");
|
JPanel racePanel = new JPanel();
|
||||||
title.setHorizontalAlignment(SwingConstants.CENTER);
|
racePanel.setOpaque(false);
|
||||||
masterPanel.add(title, BorderLayout.NORTH);
|
add(racePanel, BorderLayout.CENTER);
|
||||||
|
racePanel.setLayout(null);
|
||||||
|
|
||||||
JPanel racesContainer = new JPanel();
|
JTextPane textPane = new JTextPane();
|
||||||
|
textPane.setBounds(47, 67, 223, 301);
|
||||||
|
racePanel.add(textPane);
|
||||||
|
|
||||||
String[] availableRaces = {"Dragonborn", "Dwarf", "Elf", "Gnome", "Half-Elf", "Halfling", "Half-Orc", "Human", "Tiefling"};
|
JPanel raceBtnPanel = new JPanel();
|
||||||
|
raceBtnPanel.setBackground(new Color(165, 42, 42));
|
||||||
|
raceBtnPanel.setBorder(new BevelBorder(BevelBorder.LOWERED, null, null, null, null));
|
||||||
|
raceBtnPanel.setBounds(311, 6, 409, 394);
|
||||||
|
racePanel.add(raceBtnPanel);
|
||||||
|
|
||||||
for (int i = 0; i < availableRaces.length; i++) {
|
JButton dragonbornBtn = new JButton("Dragonborn");
|
||||||
|
dragonbornBtn.addActionListener(new ActionListener() {
|
||||||
racesContainer.add(createButton(availableRaces[i]));
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
masterPanel.add(racesContainer);
|
|
||||||
|
|
||||||
add(masterPanel);
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
private JButton createButton(String userChoice) {
|
|
||||||
|
|
||||||
JButton button = new JButton(userChoice);
|
|
||||||
|
|
||||||
button.addActionListener(
|
|
||||||
|
|
||||||
new ActionListener() {
|
|
||||||
@Override
|
|
||||||
public void actionPerformed(ActionEvent e) {
|
public void actionPerformed(ActionEvent e) {
|
||||||
|
}
|
||||||
|
});
|
||||||
|
raceBtnPanel.add(dragonbornBtn);
|
||||||
|
|
||||||
|
JPanel backContPanel = new JPanel();
|
||||||
|
backContPanel.setBackground(new Color(205, 133, 63));
|
||||||
|
add(backContPanel, BorderLayout.SOUTH);
|
||||||
|
|
||||||
|
JButton backBtn = new JButton("<--- Back ");
|
||||||
|
// backContPanel.add(backBtn);
|
||||||
|
backContPanel.add(backButton);
|
||||||
|
|
||||||
|
JButton continueBtn = new JButton("Continue --->");
|
||||||
|
// backContPanel.add(continueBtn);
|
||||||
|
backContPanel.add(continueButton);
|
||||||
|
|
||||||
System.out.println(userChoice);
|
|
||||||
raceChoice = userChoice;
|
|
||||||
ableToContinue = true;
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
);
|
|
||||||
|
|
||||||
return button;
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getRaceChoice() {
|
|
||||||
|
|
||||||
return raceChoice;
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean isAbleToContinue() {
|
|
||||||
|
|
||||||
return ableToContinue;
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|||||||
@@ -1,4 +0,0 @@
|
|||||||
package GUI.Panels;
|
|
||||||
|
|
||||||
public class DescriptionPanel {
|
|
||||||
}
|
|
||||||
@@ -1,4 +0,0 @@
|
|||||||
package GUI.Panels;
|
|
||||||
|
|
||||||
public class EquipmentPanel {
|
|
||||||
}
|
|
||||||
@@ -1,4 +0,0 @@
|
|||||||
package GUI.Panels;
|
|
||||||
|
|
||||||
public class FinalizePanel {
|
|
||||||
}
|
|
||||||
@@ -1,88 +0,0 @@
|
|||||||
package GUI.Panels;
|
|
||||||
|
|
||||||
import javax.swing.JPanel;
|
|
||||||
import java.awt.BorderLayout;
|
|
||||||
import javax.swing.JLabel;
|
|
||||||
import javax.swing.SwingConstants;
|
|
||||||
import java.awt.Font;
|
|
||||||
import javax.swing.border.MatteBorder;
|
|
||||||
import java.awt.Color;
|
|
||||||
import javax.swing.border.CompoundBorder;
|
|
||||||
import javax.swing.border.EmptyBorder;
|
|
||||||
import javax.swing.border.EtchedBorder;
|
|
||||||
import javax.swing.border.BevelBorder;
|
|
||||||
import java.awt.GridLayout;
|
|
||||||
import javax.swing.JButton;
|
|
||||||
import java.awt.event.ActionListener;
|
|
||||||
import java.awt.event.ActionEvent;
|
|
||||||
|
|
||||||
public class MainMenu extends JPanel {
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Create the panel.
|
|
||||||
*/
|
|
||||||
public MainMenu() {
|
|
||||||
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 mainMenuLbl = mainMenuLbl();
|
|
||||||
add(mainMenuLbl, BorderLayout.NORTH);
|
|
||||||
|
|
||||||
JPanel controlPanel = createControlPanel();
|
|
||||||
add(controlPanel, BorderLayout.CENTER);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
private JPanel createControlPanel() {
|
|
||||||
JPanel controlPanel = new JPanel();
|
|
||||||
controlPanel.setOpaque(false);
|
|
||||||
controlPanel.setLayout(null);
|
|
||||||
|
|
||||||
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);
|
|
||||||
|
|
||||||
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);
|
|
||||||
|
|
||||||
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;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @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;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,48 +1,83 @@
|
|||||||
package GUI.Panels;
|
package GUI.Panels;
|
||||||
|
|
||||||
import javax.swing.*;
|
import javax.swing.JPanel;
|
||||||
import java.awt.*;
|
import java.awt.BorderLayout;
|
||||||
import java.awt.event.*;
|
import javax.swing.JLabel;
|
||||||
|
import javax.swing.SwingConstants;
|
||||||
|
import java.awt.Font;
|
||||||
|
import java.awt.Color;
|
||||||
|
import javax.swing.border.BevelBorder;
|
||||||
|
import javax.swing.JButton;
|
||||||
|
import java.awt.event.ActionListener;
|
||||||
|
import java.awt.event.ActionEvent;
|
||||||
|
|
||||||
public class MainMenuPanel extends JPanel {
|
public class MainMenuPanel extends JPanel {
|
||||||
|
|
||||||
private int nextPanelSelected;
|
/**
|
||||||
|
* Create the panel.
|
||||||
|
*/
|
||||||
public MainMenuPanel() {
|
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));
|
||||||
|
setLayout(new BorderLayout(0, 0));
|
||||||
|
|
||||||
super();
|
JLabel mainMenuLbl = mainMenuLbl();
|
||||||
createMasterPanel();
|
add(mainMenuLbl, BorderLayout.NORTH);
|
||||||
|
|
||||||
|
JPanel controlPanel = createControlPanel();
|
||||||
|
add(controlPanel, BorderLayout.CENTER);
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: Need to refactor/re-write, as current implementation utilizes ContinueButton.
|
/**
|
||||||
private void createMasterPanel() {
|
* @return
|
||||||
|
*/
|
||||||
|
private JPanel createControlPanel() {
|
||||||
|
JPanel controlPanel = new JPanel();
|
||||||
|
controlPanel.setOpaque(false);
|
||||||
|
controlPanel.setLayout(null);
|
||||||
|
|
||||||
/*setLayout(new BorderLayout(0, 0));
|
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 masterPanel = new JPanel();
|
JButton randCharacterBtn = new JButton("Random Character");
|
||||||
|
randCharacterBtn.addActionListener(new ActionListener() {
|
||||||
JLabel title = new JLabel("D&D Character Builder");
|
public void actionPerformed(ActionEvent e) {
|
||||||
title.setHorizontalAlignment(SwingConstants.CENTER);
|
}
|
||||||
masterPanel.add(title, BorderLayout.NORTH);
|
});
|
||||||
|
randCharacterBtn.setOpaque(true);
|
||||||
JPanel buttonsContainer = new JPanel(new GridLayout(1, 2, 10, 10));
|
randCharacterBtn.setBackground(new Color(160, 82, 45));
|
||||||
|
randCharacterBtn.setFont(new Font("Bodoni 72 Oldstyle", Font.PLAIN, 23));
|
||||||
JPanel newCharacterContainer = new JPanel(new GridLayout(2, 1, 10, 10));
|
randCharacterBtn.setBounds(118, 156, 200, 50);
|
||||||
newCharacterContainer.add(new Button("Create a New Character", 1));
|
controlPanel.add(randCharacterBtn);
|
||||||
newCharacterContainer.add(new Button("Generate a Random Character", -1));
|
|
||||||
buttonsContainer.add(newCharacterContainer);
|
|
||||||
|
|
||||||
JPanel loadCharacterContainer = new JPanel();
|
|
||||||
loadCharacterContainer.add(new Button("Load a Character", 7));
|
|
||||||
buttonsContainer.add(loadCharacterContainer);
|
|
||||||
|
|
||||||
masterPanel.add(buttonsContainer);
|
|
||||||
|
|
||||||
add(masterPanel);*/
|
|
||||||
|
|
||||||
|
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;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @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;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -1,68 +0,0 @@
|
|||||||
package GUI.Panels;
|
|
||||||
|
|
||||||
import java.awt.BorderLayout;
|
|
||||||
import java.awt.Color;
|
|
||||||
import java.awt.Font;
|
|
||||||
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.JScrollPane;
|
|
||||||
import javax.swing.JTextArea;
|
|
||||||
import javax.swing.JTextPane;
|
|
||||||
|
|
||||||
public class step1 extends JPanel {
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Create the panel.
|
|
||||||
*/
|
|
||||||
public step1() {
|
|
||||||
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 = new JLabel("Step 1: Choose Race");
|
|
||||||
lblNewLabel.setHorizontalAlignment(SwingConstants.CENTER);
|
|
||||||
lblNewLabel.setFont(new Font("Bodoni 72 Oldstyle", Font.PLAIN, 33));
|
|
||||||
add(lblNewLabel, BorderLayout.NORTH);
|
|
||||||
|
|
||||||
JPanel racePanel = new JPanel();
|
|
||||||
racePanel.setOpaque(false);
|
|
||||||
add(racePanel, BorderLayout.CENTER);
|
|
||||||
racePanel.setLayout(null);
|
|
||||||
|
|
||||||
JTextPane textPane = new JTextPane();
|
|
||||||
textPane.setBounds(47, 67, 223, 301);
|
|
||||||
racePanel.add(textPane);
|
|
||||||
|
|
||||||
JPanel raceBtnPanel = new JPanel();
|
|
||||||
raceBtnPanel.setBackground(new Color(165, 42, 42));
|
|
||||||
raceBtnPanel.setBorder(new BevelBorder(BevelBorder.LOWERED, null, null, null, null));
|
|
||||||
raceBtnPanel.setBounds(311, 6, 409, 394);
|
|
||||||
racePanel.add(raceBtnPanel);
|
|
||||||
|
|
||||||
JButton dragonbornBtn = new JButton("Dragonborn");
|
|
||||||
dragonbornBtn.addActionListener(new ActionListener() {
|
|
||||||
public void actionPerformed(ActionEvent e) {
|
|
||||||
}
|
|
||||||
});
|
|
||||||
raceBtnPanel.add(dragonbornBtn);
|
|
||||||
|
|
||||||
JPanel backContPanel = new JPanel();
|
|
||||||
backContPanel.setBackground(new Color(205, 133, 63));
|
|
||||||
add(backContPanel, BorderLayout.SOUTH);
|
|
||||||
|
|
||||||
JButton backBtn = new JButton("<--- Back ");
|
|
||||||
backContPanel.add(backBtn);
|
|
||||||
|
|
||||||
JButton continueBtn = new JButton("Continue --->");
|
|
||||||
backContPanel.add(continueBtn);
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,201 +0,0 @@
|
|||||||
package GUI.Panels;
|
|
||||||
|
|
||||||
import java.awt.BorderLayout;
|
|
||||||
import java.awt.Color;
|
|
||||||
import java.awt.Font;
|
|
||||||
import java.awt.event.ActionEvent;
|
|
||||||
import java.awt.event.ActionListener;
|
|
||||||
|
|
||||||
import javax.swing.JPanel;
|
|
||||||
import javax.swing.JTextPane;
|
|
||||||
import javax.swing.SwingConstants;
|
|
||||||
import javax.swing.border.BevelBorder;
|
|
||||||
import javax.swing.JButton;
|
|
||||||
import javax.swing.JLabel;
|
|
||||||
|
|
||||||
public class step2 extends JPanel {
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Create the panel.
|
|
||||||
*/
|
|
||||||
public step2() {
|
|
||||||
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.setOpaque(false);
|
|
||||||
innerPanel.setLayout(null);
|
|
||||||
|
|
||||||
JPanel infoPanel = createInfoPanel();
|
|
||||||
innerPanel.add(infoPanel);
|
|
||||||
|
|
||||||
JPanel btnPanel = createBtnPanel();
|
|
||||||
innerPanel.add(btnPanel);
|
|
||||||
|
|
||||||
add(innerPanel, BorderLayout.CENTER);
|
|
||||||
}
|
|
||||||
|
|
||||||
private JPanel createBtnPanel() {
|
|
||||||
JPanel btnPanel = new JPanel();
|
|
||||||
btnPanel.setBackground(new Color(165, 42, 42));
|
|
||||||
btnPanel.setBorder(new BevelBorder(BevelBorder.LOWERED, null, null, null, null));
|
|
||||||
btnPanel.setBounds(311, 6, 409, 394);
|
|
||||||
|
|
||||||
JButton artificerBtn = new JButton("Artificer");
|
|
||||||
artificerBtn.addActionListener(new ActionListener() {
|
|
||||||
public void actionPerformed(ActionEvent e) {
|
|
||||||
}
|
|
||||||
});
|
|
||||||
btnPanel.add(artificerBtn);
|
|
||||||
|
|
||||||
JButton barbarianBtn = new JButton("Barbarian");
|
|
||||||
barbarianBtn.addActionListener(new ActionListener() {
|
|
||||||
public void actionPerformed(ActionEvent e) {
|
|
||||||
}
|
|
||||||
});
|
|
||||||
btnPanel.add(barbarianBtn);
|
|
||||||
|
|
||||||
JButton bardBtn = new JButton("Bard");
|
|
||||||
bardBtn.addActionListener(new ActionListener() {
|
|
||||||
public void actionPerformed(ActionEvent e) {
|
|
||||||
}
|
|
||||||
});
|
|
||||||
btnPanel.add(bardBtn);
|
|
||||||
|
|
||||||
JButton clericBtn = new JButton("Cleric");
|
|
||||||
clericBtn.addActionListener(new ActionListener() {
|
|
||||||
public void actionPerformed(ActionEvent e) {
|
|
||||||
}
|
|
||||||
});
|
|
||||||
btnPanel.add(clericBtn);
|
|
||||||
|
|
||||||
JButton druidBtn = new JButton("Druid");
|
|
||||||
druidBtn.addActionListener(new ActionListener() {
|
|
||||||
public void actionPerformed(ActionEvent e) {
|
|
||||||
}
|
|
||||||
});
|
|
||||||
btnPanel.add(druidBtn);
|
|
||||||
|
|
||||||
JButton fighterBtn = new JButton("Figther");
|
|
||||||
fighterBtn.addActionListener(new ActionListener() {
|
|
||||||
public void actionPerformed(ActionEvent e) {
|
|
||||||
}
|
|
||||||
});
|
|
||||||
btnPanel.add(fighterBtn);
|
|
||||||
|
|
||||||
JButton monkBtn = new JButton("Monk");
|
|
||||||
monkBtn.addActionListener(new ActionListener() {
|
|
||||||
public void actionPerformed(ActionEvent e) {
|
|
||||||
}
|
|
||||||
});
|
|
||||||
btnPanel.add(monkBtn);
|
|
||||||
|
|
||||||
JButton paladinBtn = new JButton("Paladin");
|
|
||||||
paladinBtn.addActionListener(new ActionListener() {
|
|
||||||
public void actionPerformed(ActionEvent e) {
|
|
||||||
}
|
|
||||||
});
|
|
||||||
btnPanel.add(paladinBtn);
|
|
||||||
|
|
||||||
JButton rangerBtn = new JButton("Ranger");
|
|
||||||
rangerBtn.addActionListener(new ActionListener() {
|
|
||||||
public void actionPerformed(ActionEvent e) {
|
|
||||||
}
|
|
||||||
});
|
|
||||||
btnPanel.add(rangerBtn);
|
|
||||||
|
|
||||||
JButton rogueBtn = new JButton("Rogue");
|
|
||||||
rogueBtn.addActionListener(new ActionListener() {
|
|
||||||
public void actionPerformed(ActionEvent e) {
|
|
||||||
}
|
|
||||||
});
|
|
||||||
btnPanel.add(rogueBtn);
|
|
||||||
|
|
||||||
JButton sorcererBtn = new JButton("Sorcerer");
|
|
||||||
sorcererBtn.addActionListener(new ActionListener() {
|
|
||||||
public void actionPerformed(ActionEvent e) {
|
|
||||||
}
|
|
||||||
});
|
|
||||||
btnPanel.add(sorcererBtn);
|
|
||||||
|
|
||||||
JButton warlockBtn = new JButton("Warlock");
|
|
||||||
warlockBtn.addActionListener(new ActionListener() {
|
|
||||||
public void actionPerformed(ActionEvent e) {
|
|
||||||
}
|
|
||||||
});
|
|
||||||
btnPanel.add(warlockBtn);
|
|
||||||
|
|
||||||
JButton wizardBtn = new JButton("Wizard");
|
|
||||||
wizardBtn.addActionListener(new ActionListener() {
|
|
||||||
public void actionPerformed(ActionEvent e) {
|
|
||||||
}
|
|
||||||
});
|
|
||||||
btnPanel.add(wizardBtn);
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
return btnPanel;
|
|
||||||
}
|
|
||||||
|
|
||||||
private JPanel createInfoPanel() {
|
|
||||||
JPanel infoPanel = new JPanel();
|
|
||||||
infoPanel.setOpaque(false);
|
|
||||||
infoPanel.setBorder(new BevelBorder(BevelBorder.LOWERED, null, null, null, null));
|
|
||||||
infoPanel.setBounds(6, 6, 293, 394);
|
|
||||||
infoPanel.setLayout(null);
|
|
||||||
|
|
||||||
JLabel infoLbl = new JLabel("Information");
|
|
||||||
infoLbl.setFont(new Font("Bodoni 72", Font.PLAIN, 20));
|
|
||||||
infoLbl.setHorizontalAlignment(SwingConstants.CENTER);
|
|
||||||
infoLbl.setBounds(92, 6, 105, 16);
|
|
||||||
infoPanel.add(infoLbl);
|
|
||||||
|
|
||||||
JTextPane infoTextPane = new JTextPane();
|
|
||||||
infoTextPane.setOpaque(false);
|
|
||||||
infoTextPane.setBounds(6, 21, 281, 367);
|
|
||||||
infoPanel.add(infoTextPane);
|
|
||||||
return infoPanel;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
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 lblNewLabel = new JLabel("Step 2: Choose Class");
|
|
||||||
lblNewLabel.setHorizontalAlignment(SwingConstants.CENTER);
|
|
||||||
lblNewLabel.setFont(new Font("Bodoni 72 Oldstyle", Font.PLAIN, 33));
|
|
||||||
return lblNewLabel;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -1,45 +0,0 @@
|
|||||||
package GUI.Panels;
|
|
||||||
|
|
||||||
import java.awt.BorderLayout;
|
|
||||||
import java.awt.EventQueue;
|
|
||||||
|
|
||||||
import javax.swing.JFrame;
|
|
||||||
import javax.swing.JPanel;
|
|
||||||
import javax.swing.border.EmptyBorder;
|
|
||||||
|
|
||||||
public class testJFrame extends JFrame {
|
|
||||||
|
|
||||||
private JPanel contentPane;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Launch the application.
|
|
||||||
*/
|
|
||||||
public static void main(String[] args) {
|
|
||||||
EventQueue.invokeLater(new Runnable() {
|
|
||||||
public void run() {
|
|
||||||
try {
|
|
||||||
testJFrame frame = new testJFrame();
|
|
||||||
frame.setVisible(true);
|
|
||||||
} catch (Exception e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Create the frame.
|
|
||||||
*/
|
|
||||||
public testJFrame() {
|
|
||||||
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
|
|
||||||
setBounds(100, 100, 730, 550);
|
|
||||||
contentPane = new JPanel();
|
|
||||||
contentPane.setBorder(new EmptyBorder(5, 5, 5, 5));
|
|
||||||
contentPane.setLayout(new BorderLayout(0, 0));
|
|
||||||
setContentPane(contentPane);
|
|
||||||
|
|
||||||
step3 panel = new step3();
|
|
||||||
contentPane.add(panel, BorderLayout.CENTER);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
Reference in New Issue
Block a user