diff --git a/src/main/java/ChatClient.java b/src/main/java/ChatClient.java index 30a7136..e7df403 100644 --- a/src/main/java/ChatClient.java +++ b/src/main/java/ChatClient.java @@ -148,16 +148,15 @@ public class ChatClient extends JFrame implements KeyListener { } private void showEmojiPicker() { - JDialog emojiDialog = new JDialog(this, "Emoji Picker", true); - emojiDialog.setDefaultCloseOperation(DISPOSE_ON_CLOSE); - emojiDialog.getContentPane().add(emojiPicker); - emojiDialog.pack(); - emojiDialog.setLocationRelativeTo(this); - emojiDialog.setVisible(true); - + // Create a dialog to display the emoji picker + JDialog emojiDialog = new JDialog(this, "Emoji Picker", true); // Create a modal dialog with a title "Emoji Picker" + emojiDialog.setDefaultCloseOperation(DISPOSE_ON_CLOSE); // Set close operation to dispose the dialog when closed + emojiDialog.getContentPane().add(emojiPicker); // Add the emoji picker component to the content pane of the dialog + emojiDialog.pack(); // Pack the dialog to fit the preferred size of its components + emojiDialog.setLocationRelativeTo(this);// Set the location of the dialog relative to the parent frame + emojiDialog.setVisible(true); // Make the dialog visible } - private void receiveMessages() { try { connectionToServer = new Socket(address, Constants.PORT);