Browse Source

refactoring: Emojis in ChatClient

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

10
src/main/java/ChatClient.java

@ -77,10 +77,10 @@ public class ChatClient extends JFrame implements KeyListener {
private Timer timer;
private JLabel timeLabel;
// Emoji
private JButton emojiButton;
private EmojiPicker emojiPicker;
public ChatClient() {
super("Chat");
address = JOptionPane.showInputDialog("bitte IP-Adresse");
@ -121,11 +121,15 @@ public class ChatClient extends JFrame implements KeyListener {
inputTextField = new JTextField();
inputTextField.setBorder(BorderFactory.createTitledBorder("Nachricht eingeben"));
inputTextField.addKeyListener(this);
// Create a panel to hold input text field and emoji picker
JPanel inputPanel = new JPanel(new BorderLayout());
inputPanel.add(inputTextField, BorderLayout.CENTER);
inputPanel.add(inputTextField, BorderLayout.CENTER); // Add input text field to the center of the panel
// Initialize EmojiPicker and add it to the input text field
emojiPicker = new EmojiPicker(inputTextField);
// Create a panel to hold emoji button
JPanel emojiPanel = new JPanel(new FlowLayout(FlowLayout.RIGHT));
emojiButton = new JButton("😀");
emojiButton.setPreferredSize(new Dimension(50, 50));

Loading…
Cancel
Save