|
|
@ -3,16 +3,19 @@ import java.awt.*; |
|
|
|
import java.awt.event.ActionEvent; |
|
|
|
import java.awt.event.ActionListener; |
|
|
|
|
|
|
|
|
|
|
|
public class EmojiPicker extends JPanel { |
|
|
|
|
|
|
|
private static final String[] emojis = {"😀", "😃", "😄", "😁", "😆", "😅", "😂", "🤣", "😊", "😇", "🙂", "🙃"}; |
|
|
|
private JTextField textField; |
|
|
|
|
|
|
|
public EmojiPicker(JTextField textField) { |
|
|
|
private static final String[] emojis = {"😀", "😃", "😄", "😁", "😆", "😅", |
|
|
|
"😂", "🤣", "😊", "😇", "🙂", "🙃"}; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public EmojiPicker(JTextField textField) { |
|
|
|
setLayout(new GridLayout(4, 3, 5, 5)); |
|
|
|
|
|
|
|
|
|
|
|
for (String emoji : emojis) { |
|
|
|
JButton emojiButton = new JButton(emoji); |
|
|
|
emojiButton.setFont(new Font("Segoe UI Emoji", Font.PLAIN, 20)); |
|
|
@ -21,7 +24,6 @@ public class EmojiPicker extends JPanel { |
|
|
|
} |
|
|
|
|
|
|
|
setPreferredSize(new Dimension(300, 200)); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
private class EmojiActionListener implements ActionListener { |
|
|
@ -34,11 +36,11 @@ public class EmojiPicker extends JPanel { |
|
|
|
|
|
|
|
@Override |
|
|
|
public void actionPerformed(ActionEvent e) { |
|
|
|
|
|
|
|
System.out.println("Selected emoji: " + emoji); |
|
|
|
textField.setText(textField.getText() + emoji); |
|
|
|
} |
|
|
|
} |
|
|
|
}} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|