From 30de7d2fa94ef9fd8de790ce0b37b09e64662c39 Mon Sep 17 00:00:00 2001 From: bergjoel93 Date: Fri, 11 Nov 2022 14:12:22 -0700 Subject: [PATCH] step2, step3, and a simple testJFrame --- dndBuilder/src/GUI/Panels/step2.java | 201 ++++++++++++++++++ dndBuilder/src/GUI/Panels/step3.java | 247 ++++++++++++++++++++++ dndBuilder/src/GUI/Panels/testJFrame.java | 45 ++++ 3 files changed, 493 insertions(+) create mode 100644 dndBuilder/src/GUI/Panels/step2.java create mode 100644 dndBuilder/src/GUI/Panels/step3.java create mode 100644 dndBuilder/src/GUI/Panels/testJFrame.java diff --git a/dndBuilder/src/GUI/Panels/step2.java b/dndBuilder/src/GUI/Panels/step2.java new file mode 100644 index 0000000..994acc9 --- /dev/null +++ b/dndBuilder/src/GUI/Panels/step2.java @@ -0,0 +1,201 @@ +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; + } + +} diff --git a/dndBuilder/src/GUI/Panels/step3.java b/dndBuilder/src/GUI/Panels/step3.java new file mode 100644 index 0000000..7e4551b --- /dev/null +++ b/dndBuilder/src/GUI/Panels/step3.java @@ -0,0 +1,247 @@ +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.JTextPane; +import java.awt.GridLayout; +import javax.swing.border.EmptyBorder; +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 { + + /** + * Create the panel. + */ + public step3() { + 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 = createInnerPanel(); + add(innerPanel, BorderLayout.CENTER); + } + + /** + * @return + */ + private JPanel createInnerPanel() { + JPanel innerPanel = new JPanel(); + innerPanel.setOpaque(false); + innerPanel.setLayout(null); + + createInfoPanel(innerPanel); + + JPanel mainAbilityPanel = new JPanel(); + mainAbilityPanel.setOpaque(false); + mainAbilityPanel.setBounds(6, 6, 505, 405); + innerPanel.add(mainAbilityPanel); + mainAbilityPanel.setLayout(new GridLayout(2, 3, 10, 10)); + + JPanel strengthPanel = createAbilityPanel("Strength"); + mainAbilityPanel.add(strengthPanel); + + JPanel dexterityPanel = createAbilityPanel("Dexterity"); + mainAbilityPanel.add(dexterityPanel); + + JPanel constitutionPanel = createAbilityPanel("Constitution"); + mainAbilityPanel.add(constitutionPanel); + + JPanel intelligencePanel = createAbilityPanel("Intelligence"); + mainAbilityPanel.add(intelligencePanel); + + JPanel wisdomPanel = createAbilityPanel("Wisdom"); + mainAbilityPanel.add(wisdomPanel); + + JPanel charismaPanel = createAbilityPanel("Charisma"); + mainAbilityPanel.add(charismaPanel); + + return innerPanel; + } + + /** + * @return + */ + private JPanel createAbilityPanel(String str) { + JPanel abilityPanel = new JPanel(); + abilityPanel.setFont(new Font("Lucida Grande", Font.PLAIN, 20)); + abilityPanel.setBackground(new Color(205, 133, 63)); + abilityPanel.setBorder(new LineBorder(new Color(165, 42, 42), 6, true)); + abilityPanel.setLayout(new BorderLayout(0, 0)); + + JLabel abilityLbl = new JLabel(str); + abilityLbl.setFont(new Font("Lucida Grande", Font.PLAIN, 19)); + abilityLbl.setHorizontalAlignment(SwingConstants.CENTER); + abilityPanel.add(abilityLbl, BorderLayout.NORTH); + + JButton btnNewButton = new JButton("Information"); + btnNewButton.addActionListener(new ActionListener() { + public void actionPerformed(ActionEvent e) { + } + }); + btnNewButton.setName("infoBtn"); + abilityPanel.add(btnNewButton, BorderLayout.SOUTH); + + JPanel panel = new JPanel(); + panel.setOpaque(false); + abilityPanel.add(panel, BorderLayout.CENTER); + panel.setLayout(null); + + JLabel scoreLbl = new JLabel("1"); + scoreLbl.setFont(new Font("Lucida Grande", Font.PLAIN, 24)); + scoreLbl.setHorizontalAlignment(SwingConstants.CENTER); + scoreLbl.setBounds(56, 50, 30, 30); + panel.add(scoreLbl); + + JButton btnNewButton_1 = new JButton("+"); + btnNewButton_1.setBorder(new BevelBorder(BevelBorder.LOWERED, null, null, null, null)); + btnNewButton_1.setFont(new Font("Lucida Grande", Font.PLAIN, 24)); + btnNewButton_1.setBounds(90, 50, 30, 30); + panel.add(btnNewButton_1); + + JButton decreaseBtn = new JButton("-"); + decreaseBtn.setFont(new Font("Lucida Grande", Font.PLAIN, 24)); + decreaseBtn.setBorder(new BevelBorder(BevelBorder.LOWERED, null, null, null, null)); + decreaseBtn.setBounds(21, 50, 30, 30); + panel.add(decreaseBtn); + return abilityPanel; + } + + /** + * @param innerPanel + */ + private void createInfoPanel(JPanel innerPanel) { + JPanel infoPanel = new JPanel(); + infoPanel.setOpaque(false); + infoPanel.setBorder(new BevelBorder(BevelBorder.LOWERED, null, null, null, null)); + infoPanel.setBounds(508, 6, 212, 405); + innerPanel.add(infoPanel); + infoPanel.setLayout(null); + + JLabel infoLbl = new JLabel("Information"); + infoLbl.setHorizontalAlignment(SwingConstants.CENTER); + infoLbl.setFont(new Font("Bodoni 72 Oldstyle", Font.PLAIN, 24)); + infoLbl.setBounds(6, 6, 200, 23); + infoPanel.add(infoLbl); + + JTextPane textPane = new JTextPane(); + textPane.setBorder(new BevelBorder(BevelBorder.LOWERED, null, null, null, null)); + textPane.setBackground(new Color(205, 133, 63)); + textPane.setBounds(6, 28, 200, 240); + infoPanel.add(textPane); + + JPanel diceRollerPanel = new JPanel(); + diceRollerPanel.setBackground(new Color(160, 82, 45)); + diceRollerPanel.setBounds(6, 269, 200, 130); + infoPanel.add(diceRollerPanel); + diceRollerPanel.setLayout(null); + + JLabel diceRollLbl = new JLabel("4 X D6 Dice Roll"); + diceRollLbl.setHorizontalAlignment(SwingConstants.CENTER); + diceRollLbl.setFont(new Font("Bodoni 72", Font.PLAIN, 16)); + diceRollLbl.setBounds(6, 0, 194, 22); + diceRollerPanel.add(diceRollLbl); + + JButton diceRollBtn = new JButton("Roll"); + diceRollBtn.addActionListener(new ActionListener() { + public void actionPerformed(ActionEvent e) { + } + }); + diceRollBtn.setBounds(45, 95, 117, 29); + diceRollerPanel.add(diceRollBtn); + + JLabel d6Lbl1 = new JLabel("1"); + d6Lbl1.setFont(new Font("Lucida Grande", Font.PLAIN, 20)); + d6Lbl1.setHorizontalAlignment(SwingConstants.CENTER); + d6Lbl1.setBorder(new BevelBorder(BevelBorder.LOWERED, null, null, null, null)); + d6Lbl1.setOpaque(true); + d6Lbl1.setBackground(new Color(255, 215, 0)); + d6Lbl1.setBounds(26, 50, 30, 30); + diceRollerPanel.add(d6Lbl1); + + JLabel d6Lbl2 = new JLabel("1"); + d6Lbl2.setFont(new Font("Lucida Grande", Font.PLAIN, 20)); + d6Lbl2.setHorizontalAlignment(SwingConstants.CENTER); + d6Lbl2.setBorder(new BevelBorder(BevelBorder.LOWERED, null, null, null, null)); + d6Lbl2.setOpaque(true); + d6Lbl2.setBackground(new Color(255, 215, 0)); + d6Lbl2.setBounds(68, 50, 30, 30); + diceRollerPanel.add(d6Lbl2); + + JLabel d6Lbl3 = new JLabel("1"); + d6Lbl3.setFont(new Font("Lucida Grande", Font.PLAIN, 20)); + d6Lbl3.setHorizontalAlignment(SwingConstants.CENTER); + d6Lbl3.setBorder(new BevelBorder(BevelBorder.LOWERED, null, null, null, null)); + d6Lbl3.setOpaque(true); + d6Lbl3.setBackground(new Color(255, 215, 0)); + d6Lbl3.setBounds(110, 50, 30, 30); + diceRollerPanel.add(d6Lbl3); + + JLabel d6lbl4 = new JLabel("1"); + d6lbl4.setFont(new Font("Lucida Grande", Font.PLAIN, 20)); + d6lbl4.setHorizontalAlignment(SwingConstants.CENTER); + d6lbl4.setBorder(new BevelBorder(BevelBorder.LOWERED, null, null, null, null)); + d6lbl4.setOpaque(true); + d6lbl4.setBackground(new Color(255, 215, 0)); + d6lbl4.setBounds(152, 50, 30, 30); + diceRollerPanel.add(d6lbl4); + } + + 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 3: Ability Scores"); + titleLbl.setHorizontalAlignment(SwingConstants.CENTER); + titleLbl.setFont(new Font("Bodoni 72 Oldstyle", Font.PLAIN, 33)); + return titleLbl; + } +} diff --git a/dndBuilder/src/GUI/Panels/testJFrame.java b/dndBuilder/src/GUI/Panels/testJFrame.java new file mode 100644 index 0000000..34ab682 --- /dev/null +++ b/dndBuilder/src/GUI/Panels/testJFrame.java @@ -0,0 +1,45 @@ +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); + } + +}