From 0e1e2c4ec4de689ff9dbc963fc9c946c585b3033 Mon Sep 17 00:00:00 2001 From: Valentin Spiroski Date: Fri, 9 Feb 2024 21:50:06 +0100 Subject: [PATCH] refactoring: Emojis in ChatClient2 --- src/main/java/ChatClient.java | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/main/java/ChatClient.java b/src/main/java/ChatClient.java index b4be3a3..3ce3327 100644 --- a/src/main/java/ChatClient.java +++ b/src/main/java/ChatClient.java @@ -131,10 +131,12 @@ public class ChatClient extends JFrame implements KeyListener { // Create a panel to hold emoji button JPanel emojiPanel = new JPanel(new FlowLayout(FlowLayout.RIGHT)); - emojiButton = new JButton("😀"); - emojiButton.setPreferredSize(new Dimension(50, 50)); - emojiButton.addActionListener(e -> showEmojiPicker()); - inputPanel.add(emojiPanel, BorderLayout.LINE_END); + emojiButton = new JButton("😀"); // Create emoji button with a smiley face + emojiButton.setPreferredSize(new Dimension(50, 50));// Set preferred size for the emoji button + emojiButton.addActionListener(e -> showEmojiPicker());// Add action listener to show emoji picker when button is clicked + + inputPanel.add(emojiPanel, BorderLayout.LINE_END);// Add emoji panel to the right side of the input panel + add(outputScrollPane, BorderLayout.CENTER); add(inputTextField, BorderLayout.PAGE_END);