debugging
This commit is contained in:
@@ -1,6 +1,9 @@
|
||||
package GUI;
|
||||
|
||||
import GUI.Panels.ChooseRacePanel;
|
||||
|
||||
import javax.swing.*;
|
||||
import java.awt.*;
|
||||
|
||||
/*
|
||||
|
||||
@@ -15,40 +18,44 @@ NOTES:
|
||||
|
||||
public class PanelHolder {
|
||||
|
||||
/*
|
||||
private JPanel mainMenuPanel;
|
||||
*/
|
||||
private JPanel racePanel;
|
||||
private JPanel classPanel;
|
||||
/* private JPanel classPanel;
|
||||
private JPanel abilityScorePanel;
|
||||
private JPanel descriptionPanel;
|
||||
private JPanel equipmentPanel;
|
||||
private JPanel finalizePanel;
|
||||
private JPanel loadMenuPanel;
|
||||
private JPanel loadMenuPanel;*/
|
||||
|
||||
private int lastPanel;
|
||||
// private int lastPanel;
|
||||
private int currentPanel;
|
||||
private int nextPanel;
|
||||
// private int nextPanel;
|
||||
|
||||
public PanelHolder() {
|
||||
|
||||
/*
|
||||
this.mainMenuPanel = createMainMenuPanel();
|
||||
*/
|
||||
this.racePanel = createRaceSelectPanel();
|
||||
this.classPanel = createClassSelectPanel();
|
||||
/* this.classPanel = createClassSelectPanel();
|
||||
this.abilityScorePanel = createAbilityScoreSelectPanel();
|
||||
this.descriptionPanel = createDescriptionPanel();
|
||||
this.equipmentPanel = createEquipmentSelectPanel();
|
||||
this.finalizePanel = createFinalizePanel();
|
||||
this.loadMenuPanel = createLoadMenu();
|
||||
lastPanel = 0;
|
||||
this.loadMenuPanel = createLoadMenu();*/
|
||||
// lastPanel = 0;
|
||||
currentPanel = 0;
|
||||
nextPanel = 0;
|
||||
// nextPanel = 0;
|
||||
|
||||
}
|
||||
|
||||
public JPanel getMainMenuPanel() {
|
||||
/* public JPanel getMainMenuPanel() {
|
||||
|
||||
return mainMenuPanel;
|
||||
|
||||
}
|
||||
}*/
|
||||
|
||||
public JPanel getRacePanel() {
|
||||
|
||||
@@ -56,7 +63,7 @@ public class PanelHolder {
|
||||
|
||||
}
|
||||
|
||||
public JPanel getClassPanel() {
|
||||
/* public JPanel getClassPanel() {
|
||||
|
||||
return classPanel;
|
||||
|
||||
@@ -92,19 +99,19 @@ public class PanelHolder {
|
||||
|
||||
}
|
||||
|
||||
/* TODO: Need to implement.
|
||||
*//* TODO: Need to implement.
|
||||
|
||||
LEFT-SIDE: Two large buttons, split with a horizontal line. One is to create a new DnD character, the other is to create a
|
||||
random character.
|
||||
|
||||
RIGHT-SIDE: One extra-large button to load an existing character.
|
||||
|
||||
*/
|
||||
*//*
|
||||
private JPanel createMainMenuPanel() {
|
||||
|
||||
return new JPanel();
|
||||
|
||||
}
|
||||
}*/
|
||||
|
||||
/* TODO: Need to implement.
|
||||
|
||||
@@ -117,14 +124,68 @@ public class PanelHolder {
|
||||
*/
|
||||
private JPanel createRaceSelectPanel() {
|
||||
|
||||
currentPanel++;
|
||||
System.out.println("Race Panel generated.");
|
||||
|
||||
JPanel display = new JPanel();
|
||||
display.setLayout(new BorderLayout(0, 0));
|
||||
|
||||
|
||||
JLabel title = new JLabel("Step 1: Choose Race");
|
||||
title.setHorizontalAlignment(SwingConstants.CENTER);
|
||||
display.add(title, BorderLayout.NORTH);
|
||||
|
||||
JPanel textPanel = new JPanel();
|
||||
textPanel.setLayout(null);
|
||||
|
||||
JLabel characterName = new JLabel("Character Name: ");
|
||||
characterName.setBounds(113, 31, 108, 16);
|
||||
textPanel.add(characterName);
|
||||
|
||||
JTextField nameTextBox = new JTextField();
|
||||
nameTextBox.setBounds(233, 26, 211, 26);
|
||||
textPanel.add(nameTextBox);
|
||||
nameTextBox.setColumns(10);
|
||||
|
||||
JLabel raceLbl = new JLabel("Choose Race: ");
|
||||
raceLbl.setBounds(113, 70, 98, 16);
|
||||
textPanel.add(raceLbl);
|
||||
|
||||
JComboBox raceComboBox = new JComboBox();
|
||||
raceComboBox.setBounds(196, 54, 221, 50);
|
||||
textPanel.add(raceComboBox);
|
||||
|
||||
JLabel genderLbl = new JLabel("Gender: ");
|
||||
genderLbl.setBounds(113, 108, 61, 16);
|
||||
textPanel.add(genderLbl);
|
||||
|
||||
JComboBox genderComboBox = new JComboBox();
|
||||
genderComboBox.setBounds(162, 92, 211, 50);
|
||||
textPanel.add(genderComboBox);
|
||||
|
||||
JLabel classLbl = new JLabel("Class: ");
|
||||
classLbl.setBounds(113, 154, 61, 16);
|
||||
textPanel.add(classLbl);
|
||||
|
||||
JComboBox classComboBox = new JComboBox();
|
||||
classComboBox.setBounds(162, 138, 200, 50);
|
||||
textPanel.add(classComboBox);
|
||||
|
||||
JLabel AlignmentLbl = new JLabel("Alignment: ");
|
||||
AlignmentLbl.setBounds(113, 200, 80, 16);
|
||||
textPanel.add(AlignmentLbl);
|
||||
|
||||
JComboBox comboBox = new JComboBox();
|
||||
comboBox.setBounds(190, 184, 200, 50);
|
||||
textPanel.add(comboBox);
|
||||
|
||||
display.add(textPanel, BorderLayout.CENTER);
|
||||
|
||||
return new JPanel();
|
||||
|
||||
}
|
||||
|
||||
// TODO: Need to implement.
|
||||
private JPanel createClassSelectPanel() {
|
||||
/* private JPanel createClassSelectPanel() {
|
||||
|
||||
currentPanel++;
|
||||
|
||||
@@ -176,5 +237,5 @@ public class PanelHolder {
|
||||
return new JPanel();
|
||||
|
||||
}
|
||||
|
||||
*/
|
||||
}
|
||||
@@ -0,0 +1,28 @@
|
||||
package GUI.Panels;
|
||||
|
||||
import javax.swing.JPanel;
|
||||
import java.awt.BorderLayout;
|
||||
import javax.swing.JLabel;
|
||||
import javax.swing.SwingConstants;
|
||||
import javax.swing.JTextField;
|
||||
import javax.swing.JComboBox;
|
||||
import java.awt.GridLayout;
|
||||
|
||||
public class ChooseRacePanel extends JPanel {
|
||||
|
||||
/**
|
||||
* Create the panel.
|
||||
*/
|
||||
public ChooseRacePanel() {
|
||||
|
||||
createPanel();
|
||||
|
||||
}
|
||||
|
||||
private void createPanel() {
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,49 @@
|
||||
package GUI.Panels;
|
||||
|
||||
import java.awt.BorderLayout;
|
||||
import java.awt.EventQueue;
|
||||
|
||||
import javax.swing.JFrame;
|
||||
import javax.swing.JPanel;
|
||||
import javax.swing.border.EmptyBorder;
|
||||
import javax.swing.JButton;
|
||||
|
||||
public class GuiCharacterFrame extends JFrame {
|
||||
|
||||
private JPanel contentPane;
|
||||
|
||||
/**
|
||||
* Launch the application.
|
||||
*/
|
||||
/* public static void main(String[] args) {
|
||||
EventQueue.invokeLater(new Runnable() {
|
||||
public void run() {
|
||||
try {
|
||||
GuiCharacterFrame frame = new GuiCharacterFrame();
|
||||
frame.setVisible(true);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
});
|
||||
}*/
|
||||
|
||||
/**
|
||||
* Create the frame.
|
||||
*/
|
||||
/* public GuiCharacterFrame() {
|
||||
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
|
||||
setBounds(100, 100, 550, 300);
|
||||
contentPane = new JPanel();
|
||||
contentPane.setBorder(new EmptyBorder(5, 5, 5, 5));
|
||||
contentPane.setLayout(new BorderLayout(0, 0));
|
||||
setContentPane(contentPane);
|
||||
|
||||
ChooseRacePanel panel = new ChooseRacePanel();
|
||||
contentPane.add(panel, BorderLayout.CENTER);
|
||||
|
||||
JButton submitBttn = new JButton("Next");
|
||||
panel.add(submitBttn, BorderLayout.SOUTH);
|
||||
}*/
|
||||
|
||||
}
|
||||
@@ -0,0 +1,96 @@
|
||||
package GUI.Panels;
|
||||
|
||||
import java.awt.BorderLayout;
|
||||
import java.awt.EventQueue;
|
||||
|
||||
import javax.swing.JFrame;
|
||||
import javax.swing.JPanel;
|
||||
import javax.swing.border.EmptyBorder;
|
||||
import java.awt.Color;
|
||||
import java.awt.GridBagLayout;
|
||||
import java.awt.GridBagConstraints;
|
||||
import javax.swing.JLabel;
|
||||
import javax.swing.JTextField;
|
||||
import java.awt.Insets;
|
||||
import java.awt.FlowLayout;
|
||||
import javax.swing.BoxLayout;
|
||||
import javax.swing.ImageIcon;
|
||||
|
||||
import java.awt.GridLayout;
|
||||
import java.awt.ScrollPane;
|
||||
import java.awt.Scrollbar;
|
||||
import javax.swing.JScrollPane;
|
||||
import javax.swing.ScrollPaneConstants;
|
||||
import javax.swing.JScrollBar;
|
||||
|
||||
public class dndCharacterSheet extends JFrame {
|
||||
|
||||
private JPanel contentPane;
|
||||
private JTextField textField;
|
||||
private JPanel panel;
|
||||
private JTextField textField_1;
|
||||
private JTextField textField_2;
|
||||
|
||||
/**
|
||||
* Launch the application.
|
||||
*/
|
||||
/* public static void main(String[] args) {
|
||||
EventQueue.invokeLater(new Runnable() {
|
||||
public void run() {
|
||||
try {
|
||||
dndCharacterSheet frame = new dndCharacterSheet();
|
||||
frame.setVisible(true);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
});
|
||||
}*/
|
||||
|
||||
/**
|
||||
* Create the frame.
|
||||
*/
|
||||
public dndCharacterSheet() {
|
||||
|
||||
JLabel imageLabel = new JLabel(new ImageIcon(getClass().getResource("/dnd/img/sheet.jpg")));
|
||||
JPanel newPanel = new JPanel();
|
||||
newPanel.add(imageLabel);
|
||||
JScrollPane scrollPane = new JScrollPane(newPanel);
|
||||
|
||||
|
||||
this.getContentPane().add(scrollPane, BorderLayout.CENTER);
|
||||
|
||||
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
|
||||
setBounds(100, 100, 850, 1200);
|
||||
setVisible(true);
|
||||
pack();
|
||||
|
||||
// contentPane = new JPanel();
|
||||
// contentPane.setBorder(new EmptyBorder(5, 5, 5, 5));
|
||||
// setContentPane(contentPane);
|
||||
// contentPane.setLayout(new BorderLayout(0, 0));
|
||||
|
||||
/*ImagePanel imagePanel = new ImagePanel();
|
||||
JScrollPane scrollPane = new JScrollPane();
|
||||
|
||||
JPanel panel1 = new JPanel();
|
||||
panel1.setLayout(new BorderLayout(0, 0));
|
||||
panel1.add(imagePanel, BorderLayout.CENTER);
|
||||
scrollPane.add(panel1);
|
||||
imagePanel.setLayout(null);
|
||||
|
||||
|
||||
contentPane.add(scrollPane, BorderLayout.CENTER);*/
|
||||
|
||||
// ImagePanel imagePanel = new ImagePanel();
|
||||
// contentPane.add(imagePanel, BorderLayout.CENTER);
|
||||
// imagePanel.setLayout(null);
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 111 KiB |
@@ -1,19 +1,20 @@
|
||||
package GUI;
|
||||
|
||||
import javax.swing.*;
|
||||
import java.awt.*;
|
||||
|
||||
public class UImanager {
|
||||
public class UImanager extends JFrame {
|
||||
|
||||
private final JFrame gui;
|
||||
private final PanelHolder guiPanels;
|
||||
private int currentPanel;
|
||||
|
||||
public UImanager (PanelHolder guiPanels, boolean returningUser) {
|
||||
|
||||
this.gui = new JFrame("D&D Character Builder");
|
||||
//public UImanager (PanelHolder guiPanels, boolean returningUser) {
|
||||
public UImanager (PanelHolder guiPanels) {
|
||||
super("D&D Character Builder");
|
||||
frameSetup();
|
||||
this.guiPanels = guiPanels;
|
||||
|
||||
if (returningUser) {
|
||||
/* if (returningUser) {
|
||||
|
||||
this.currentPanel = 0;
|
||||
|
||||
@@ -21,22 +22,33 @@ public class UImanager {
|
||||
|
||||
this.currentPanel = 1;
|
||||
|
||||
}
|
||||
}*/
|
||||
|
||||
frameSetup();
|
||||
clearAndReset(getNextPanel());
|
||||
|
||||
}
|
||||
|
||||
// TODO: Need to implement.
|
||||
private void frameSetup() {
|
||||
|
||||
setDefaultCloseOperation(EXIT_ON_CLOSE);
|
||||
setLayout(new BorderLayout());
|
||||
setPreferredSize(new Dimension(600,600));
|
||||
setSize(getPreferredSize());
|
||||
|
||||
try {
|
||||
UIManager.setLookAndFeel( UIManager.getCrossPlatformLookAndFeelClassName() );
|
||||
} catch (Exception e) {
|
||||
System.out.println("Error with cross platform look/feel in frameSetup().");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private JPanel getNextPanel() {
|
||||
|
||||
return switch (currentPanel) {
|
||||
return guiPanels.getRacePanel();
|
||||
|
||||
/* return switch (currentPanel) {
|
||||
case 1 -> guiPanels.getRacePanel();
|
||||
case 2 -> guiPanels.getClassPanel();
|
||||
case 3 -> guiPanels.getAbilityScorePanel();
|
||||
@@ -45,17 +57,17 @@ public class UImanager {
|
||||
case 6 -> guiPanels.getLoadMenuPanel();
|
||||
case 7 -> guiPanels.getFinalizePanel();
|
||||
default -> guiPanels.getMainMenuPanel();
|
||||
};
|
||||
};*/
|
||||
|
||||
}
|
||||
|
||||
private void clearAndReset(JPanel nextPanel) {
|
||||
|
||||
gui.removeAll();
|
||||
gui.add(nextPanel);
|
||||
removeAll();
|
||||
add(nextPanel);
|
||||
|
||||
gui.repaint();
|
||||
gui.revalidate();
|
||||
repaint();
|
||||
revalidate();
|
||||
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user