7/6/2023 0 Comments How to show emojis on mac("can display result: " + font.canDisplayUpTo(emoji)) String fontFamily = os.equals("Mac OS X") ? "Apple Color Emoji" : "Segoe UI Emoji" įont font = new Font(fontFamily, Font.PLAIN, 20) String os = System.getProperty("os.name") JPanel holder = new JPanel() // Let button be natural size String emoji = "□" // dog face listFonts() // Uncomment if you want to see all registered fonts.įtTitle("Emoji Demo: " + System.getProperty("os.name")) Here is the source code filename is EmojiTest.java: import java.awt.* This program runs correctly and displays the emoji on Windows, but not on Mac OS (Catalina, AdoptOpenJDK15). I have here a simple, complete, self-contained, pure-Java program that displays a frame containing a button with a Unicode emoji character as its text.
0 Comments
Leave a Reply. |