diff --git a/src/main/java/ChatGUI.java b/src/main/java/ChatGUI.java index 4340cd3..de20bd9 100644 --- a/src/main/java/ChatGUI.java +++ b/src/main/java/ChatGUI.java @@ -16,14 +16,19 @@ import javax.swing.JTextField; public class ChatGUI implements ActionListener { + // Menu items for font sizes JMenuItem small = new JMenuItem("small-font"); JMenuItem medium = new JMenuItem("medium-font"); JMenuItem large = new JMenuItem("large-font"); - JMenuItem exit = new JMenuItem("Exit"); + + // Menu items for font colors JMenuItem black = new JMenuItem("black"); JMenuItem red = new JMenuItem("red"); JMenuItem blue = new JMenuItem("blue"); JMenuItem green = new JMenuItem("green"); + + JMenuItem exit = new JMenuItem("Exit"); + JTextField inputTextField = new JTextField(); JTextArea outputTextArea = new JTextArea(); @@ -35,12 +40,13 @@ public class ChatGUI implements ActionListener { // Set up the main frame gui.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); gui.setTitle("java-chat"); - gui.setLayout(new BorderLayout()); - + + // Set up the menu bar JMenuBar bar = new JMenuBar(); gui.setJMenuBar(bar); - + + // Create menu items and menus JMenu options = new JMenu("options"); JMenu colors = new JMenu("font-colors"); JMenu size = new JMenu("font-size"); @@ -60,7 +66,8 @@ public class ChatGUI implements ActionListener { size.add(small); size.add(medium); size.add(large); - + + // Register action listeners for menu items red.addActionListener(this); blue.addActionListener(this); black.addActionListener(this); @@ -90,7 +97,7 @@ public class ChatGUI implements ActionListener { gui.setSize(quarterWidth, quarterHeight); gui.setVisible(true); } - + // main methode zum Testen, müsste bei Implementation entfernt werden public static void main(String[] args) { new ChatGUI();