I struggle with this problem a lot and I cannot understand it. I need to somehow display Emoji (like in WhatsApp) in a JavaFX application.
I tried this with awt and Swing, and now I had no success (EDIT: swt works, but probably only for Mac). I tried it with advanced Unicode and Codepoints, but that didn't help. I hope this is even possible, because Windows usually does not allow Emoji to be displayed (I myself use a Mac).
Today I came across this post about Emoji in JavaFX 8 . There, the guy says that he implemented a way to display Emoji in JavaFX by extending the class javafx.scene.text.TextFlow. There is also a link to a small presentation and from the 57th slide upwards it explains a little these so-called objects EmojiFlow. However, I can not find the download!
Thanks to everyone who answered, I struggled with this for so long, maybe this is even impossible.
Here is a small non-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();
TextFlow textFlow = new TextFlow(new Text("Should be alien smiley: "
+ (char) 0xF47D));
root.getChildren().add(textFlow);
Scene scene = new Scene(root);
stage.setScene(scene);
stage.show();
}
public static void main(String[] args) {
launch(args);
}
}
source
share