From 91279d4835d8bc25ad3215e55426008ea5dea25d Mon Sep 17 00:00:00 2001 From: Valentin Spiroski Date: Fri, 9 Feb 2024 22:05:33 +0100 Subject: [PATCH] refactoring: EmojiPicker4 --- src/main/java/EmojiPicker.java | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/src/main/java/EmojiPicker.java b/src/main/java/EmojiPicker.java index 85c1f21..dfba42d 100644 --- a/src/main/java/EmojiPicker.java +++ b/src/main/java/EmojiPicker.java @@ -33,10 +33,17 @@ public class EmojiPicker extends JPanel { setPreferredSize(new Dimension(300, 200)); // Set preferred size for the EmojiPicker panel } - + /** + * ActionListener for handling emoji button clicks. + */ private class EmojiActionListener implements ActionListener { - private String emoji; + private String emoji; // Selected emoji + + /** + * Constructs an EmojiActionListener with the specified emoji. + * @param emoji The emoji associated with this listener. + */ public EmojiActionListener(String emoji) { this.emoji = emoji; @@ -44,7 +51,7 @@ public class EmojiPicker extends JPanel { @Override public void actionPerformed(ActionEvent e) { - System.out.println("Selected emoji: " + emoji); + System.out.println("Selected emoji: " + emoji); textField.setText(textField.getText() + emoji); } }