Browse Source

refactoring: Emojis in ChatClient

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

8
src/main/java/ChatClient.java

@ -77,10 +77,10 @@ public class ChatClient extends JFrame implements KeyListener {
private Timer timer; private Timer timer;
private JLabel timeLabel; private JLabel timeLabel;
// Emoji
private JButton emojiButton; private JButton emojiButton;
private EmojiPicker emojiPicker; private EmojiPicker emojiPicker;
public ChatClient() { public ChatClient() {
super("Chat"); super("Chat");
address = JOptionPane.showInputDialog("bitte IP-Adresse"); address = JOptionPane.showInputDialog("bitte IP-Adresse");
@ -122,10 +122,14 @@ public class ChatClient extends JFrame implements KeyListener {
inputTextField.setBorder(BorderFactory.createTitledBorder("Nachricht eingeben")); inputTextField.setBorder(BorderFactory.createTitledBorder("Nachricht eingeben"));
inputTextField.addKeyListener(this); inputTextField.addKeyListener(this);
// Create a panel to hold input text field and emoji picker
JPanel inputPanel = new JPanel(new BorderLayout()); 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); emojiPicker = new EmojiPicker(inputTextField);
// Create a panel to hold emoji button
JPanel emojiPanel = new JPanel(new FlowLayout(FlowLayout.RIGHT)); JPanel emojiPanel = new JPanel(new FlowLayout(FlowLayout.RIGHT));
emojiButton = new JButton("😀"); emojiButton = new JButton("😀");
emojiButton.setPreferredSize(new Dimension(50, 50)); emojiButton.setPreferredSize(new Dimension(50, 50));

Loading…
Cancel
Save