简体   繁体   中英

Add emoji window or keyboard in javafx

I am developing a java chat application using javafx.I want to add emoji window with so many emoji just like Viber desktop. Is it possible to add Smiley's in javafx ?

In googling i found Unicode for smily which is too large for implement.So please anyone help me with this.

You can create a emoji window with a grid pane and buttons but if you will try to add emoji like this: button.setText("😁") IT WILL NOT WORK

Follow these steps to add Emoji as a text:

  1. head to https://apps.timwhitlock.info/emoji/tables/unicode Search for any emoji you want and check its byte code (eg. \\xF0\\x9F\\x98\\x81)

  2. create a byte array and add byte code to it eg. I am using this emoji: 😁 and Its byte code is \\xF0\\x9F\\x98\\x81 so,


byte[] emojiByteCode = new byte[]{(byte)0xF0, (byte)0x9F, (byte)0x98, (byte)0x81};

  1. create a new string,

String emoji = new String(emojiByteCode, Charset.forName("UTF-8"));

  1. You can use this string as a label, button, etc. to display the emoji. THIS IS A COMMUNITY WIKI

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM