Browse Source

refactoring: Emojis in ChatClient3

remotes/origin/client-handler
Valentin Spiroski 11 months ago
parent
commit
ba3b8fa4e0
  1. 15
      src/main/java/ChatClient.java

15
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);

Loading…
Cancel
Save