|
@ -3,15 +3,22 @@ import java.awt.*; |
|
|
import java.awt.event.ActionEvent; |
|
|
import java.awt.event.ActionEvent; |
|
|
import java.awt.event.ActionListener; |
|
|
import java.awt.event.ActionListener; |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
|
* A panel containing a selection of emoji buttons to be used in conjunction with a JTextField. |
|
|
|
|
|
*/ |
|
|
|
|
|
|
|
|
public class EmojiPicker extends JPanel { |
|
|
public class EmojiPicker extends JPanel { |
|
|
|
|
|
|
|
|
private JTextField textField; |
|
|
|
|
|
|
|
|
private JTextField textField; // Text field to append selected emoji |
|
|
|
|
|
|
|
|
|
|
|
// Array containing a selection of emojis |
|
|
private static final String[] emojis = {"😀", "😃", "😄", "😁", "😆", "😅", |
|
|
private static final String[] emojis = {"😀", "😃", "😄", "😁", "😆", "😅", |
|
|
"😂", "🤣", "😊", "😇", "🙂", "🙃"}; |
|
|
"😂", "🤣", "😊", "😇", "🙂", "🙃"}; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
|
* Constructs an EmojiPicker with a specified JTextField. |
|
|
|
|
|
* @param textField The JTextField to append selected emojis. |
|
|
|
|
|
*/ |
|
|
public EmojiPicker(JTextField textField) { |
|
|
public EmojiPicker(JTextField textField) { |
|
|
setLayout(new GridLayout(4, 3, 5, 5)); |
|
|
setLayout(new GridLayout(4, 3, 5, 5)); |
|
|
|
|
|
|
|
|