package package1; import java.awt.Color; import java.awt.Font; import java.awt.GridLayout; import javax.swing.JButton; import javax.swing.JFrame; import javax.swing.JLabel; import javax.swing.JPanel; import javax.swing.JTextArea; import package1.Game.ChoiceHandler; public class UI { JFrame window; JPanel titleNamePanel, startButtonPanel, mainTextPanel, choiceButtonPanel, playerPanel; JLabel titleNameLabel, sanityLabel, sanityConditionLabel, hungerLabel, hungerNumberLabel, thirstLabel, thirstNumberLabel, weaponLabel, weaponNameLabel; JButton startButton, choice1, choice2, choice3, choice4; JTextArea mainTextArea; Font titleFont = new Font("Chiller", Font.ITALIC, 100); Font normalFont = new Font("Monospaced", Font.PLAIN, 26); public void createUI(ChoiceHandler cHandler) { //Window window = new JFrame(); window.setSize(1500, 900); window.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); window.getContentPane().setBackground(Color.black); window.setLayout(null); //Title Screen titleNamePanel = new JPanel(); titleNamePanel.setBounds(500, 100, 500, 100); titleNamePanel.setBackground(Color.black); titleNameLabel = new JLabel("The Backrooms"); titleNameLabel.setForeground(Color.white); titleNameLabel.setFont(titleFont); titleNamePanel.add(titleNameLabel); startButtonPanel = new JPanel(); startButtonPanel.setBounds(650, 700, 200, 100); startButtonPanel.setBackground(Color.black); startButton = new JButton("Begin"); startButton.setBackground(Color.black); startButton.setForeground(Color.white); startButton.setFont(normalFont); startButton.setFocusPainted(false); startButton.addActionListener(cHandler); startButton.setActionCommand("Start"); startButtonPanel.add(startButton); window.add(titleNamePanel); window.add(startButtonPanel); //Game Screen mainTextPanel = new JPanel(); mainTextPanel.setBounds(710, 200, 600, 250); mainTextPanel.setBackground(Color.black); window.add(mainTextPanel); mainTextArea = new JTextArea("null"); mainTextArea.setBounds(710, 200, 600, 250); mainTextArea.setBackground(Color.black); mainTextArea.setForeground(Color.white); mainTextArea.setFont(normalFont); mainTextArea.setLineWrap(true); mainTextArea.setWrapStyleWord(true); mainTextArea.setEditable(false); mainTextPanel.add(mainTextArea); choiceButtonPanel = new JPanel(); choiceButtonPanel.setBounds(480, 550, 500, 250); choiceButtonPanel.setBackground(Color.black); choiceButtonPanel.setLayout(new GridLayout(4,1)); window.add(choiceButtonPanel); choice1 = new JButton("Choice1"); choice1.setBackground(Color.black); choice1.setForeground(Color.white); choice1.setFont(normalFont); choice1.setFocusPainted(false); choice1.addActionListener(cHandler); choice1.setActionCommand("c1"); choiceButtonPanel.add(choice1); choice2 = new JButton("Choice2"); choice2.setBackground(Color.black); choice2.setForeground(Color.white); choice2.setFont(normalFont); choice2.setFocusPainted(false); choice2.addActionListener(cHandler); choice2.setActionCommand("c2"); choiceButtonPanel.add(choice2); choice3 = new JButton("Choice3"); choice3.setBackground(Color.black); choice3.setForeground(Color.white); choice3.setFont(normalFont); choice3.setFocusPainted(false); choice3.addActionListener(cHandler); choice3.setActionCommand("c2"); choiceButtonPanel.add(choice3); choice4 = new JButton("Choice4"); choice4.setBackground(Color.black); choice4.setForeground(Color.white); choice4.setFont(normalFont); choice4.setFocusPainted(false); choice4.addActionListener(cHandler); choice4.setActionCommand("c4"); choiceButtonPanel.add(choice4); playerPanel = new JPanel(); playerPanel.setBounds(200, 20, 1300, 50); playerPanel.setBackground(Color.black); playerPanel.setLayout(new GridLayout(1,4)); window.add(playerPanel); sanityLabel = new JLabel("Sanity:"); sanityLabel.setFont(normalFont); sanityLabel.setBackground(Color.white); playerPanel.add(sanityLabel); sanityConditionLabel = new JLabel(); sanityConditionLabel.setForeground(Color.white); sanityConditionLabel.setFont(normalFont); playerPanel.add(sanityConditionLabel); hungerLabel = new JLabel("Hunger:"); hungerLabel.setFont(normalFont); hungerLabel.setBackground(Color.white); playerPanel.add(hungerLabel); hungerNumberLabel = new JLabel(); hungerNumberLabel.setForeground(Color.white); hungerNumberLabel.setFont(normalFont); playerPanel.add(hungerNumberLabel); thirstLabel = new JLabel("Hydration:"); thirstLabel.setFont(normalFont); thirstLabel.setBackground(Color.white); playerPanel.add(thirstLabel); thirstNumberLabel = new JLabel(); thirstNumberLabel.setForeground(Color.white); thirstNumberLabel.setFont(normalFont); playerPanel.add(thirstNumberLabel); weaponLabel = new JLabel("Weapon:"); weaponLabel.setFont(normalFont); weaponLabel.setBackground(Color.white); playerPanel.add(weaponLabel); weaponNameLabel = new JLabel(); weaponNameLabel.setBackground(Color.white); weaponNameLabel.setFont(normalFont); playerPanel.add(weaponNameLabel); window.setVisible(true); } }