I've been struggling with this problem a lot now and I can't seem to figure it out. I need some way of displaying Emoji's (as in WhatsApp) in a JavaFX Application.
I tried it with awt and Swing and I haven't had any success now (EDIT: swt works but probably just for Mac's) I tried it with extended Unicode and Codepoints but this didn't help. I hope it's even possible, because Windows usually doesn't let you display Emoji's (I myself use a Mac).
Today I stumbled over this post about Emoji's in JavaFX 8. There a guy says he has implemented a way of displaying Emoji's in JavaFX by extending the javafx.scene.text.TextFlow
class. There is also a link to a little presentation and from the 57th slide upwards it explains these so called EmojiFlow
objects a little.
However I can't seem to find a download!
Thanks to everyone answering, I've been struggling so long with this one, maybe it even is impossible
Here is a little not working example:
import javafx.application.Application;
import javafx.scene.Scene;
import javafx.scene.layout.VBox;
import javafx.scene.text.Text;
import javafx.scene.text.TextFlow;
import javafx.stage.Stage;
public class Main extends Application {
@Override
public void start(Stage stage) {
VBox root = new VBox();
// I used TextFlow here because the article suggested
// extending this class, but I know it's not working
// just like this
TextFlow textFlow = new TextFlow(new Text("Should be alien smiley: "
+ (char) 0xF47D));
// casting a hex number to a char is equal to using "\uF47D"
root.getChildren().add(textFlow);
Scene scene = new Scene(root);
stage.setScene(scene);
stage.show();
}
public static void main(String[] args) {
launch(args);
}
}