commit 1f216e4d4bc83533ce9a433e5bc8c20d18c0fcac parent 7f4b6e366968e520e8f0f29a0c168734e06f2543 Author: William Lindholm <william_lindholm@outlook.com> Date: Mon, 13 Feb 2023 14:39:55 +0100 Added comments Diffstat:
| M | OOP2023_a22willi_a21liltr_assignment2/src/assignment2/GUI.java | | | 5 | ++++- |
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/OOP2023_a22willi_a21liltr_assignment2/src/assignment2/GUI.java b/OOP2023_a22willi_a21liltr_assignment2/src/assignment2/GUI.java @@ -50,11 +50,14 @@ public class GUI implements ActionListener { } /* + * Create button, add ActionListener to button and add button to GUI. * + * @param key Used for distinguishing buttons from each other, unique "name" + * @param btnText Button text */ private void createButton(String key, String btnText) { buttons.put(key, new JButton(btnText)); //Create new button and add to Map using key value - buttons.get(key).addActionListener(this); //add actionlistener to button + buttons.get(key).addActionListener(this); //add ActionListener to button menu.add(buttons.get(key)); // add button to GUI }