Skip to content
Advertisement

Colored Emojis in Java Swing Labels

I was wondering how to dispaly colored emojis in swing. I have a feeling that the Swing (awt) font engine is unable to do this. I’ve tried using the windows emoji font (Segoe UI Emoji), but sadly it only displays the monochrome variants. Is there any UIManager-Property or Client-Property that I can set in order to get the non-monochrome variant or is Swing simply unable to do this?

I have also noticed that by default Swing doesn’t display emoji at all. I thought that if there is an emoji font available, that there’d be some kind of fallback. Usually an emoji font doesn’t contain things besides emoji as far as I understand. So for example I would use Segoe UI which would use Segoe UI Emoji for the emojis. On the other hand it should be possible to use Segoe UI for the normal text and Noto Color Emoji for the emojis. Am I missunderstanding something here?

Advertisement

Answer

Swing is not built to support colored emojis.

Those are usually rendered by web browsers, so the Java-FX WebView might be able to support them (AFAIU it actually embeds a browser).

Swing, OTOH was designed to handle a sub-set of HTML 3.2 (yes, it’s that old).

Advertisement