by Njål

Displaying Chinese Characters in Java Swing (JLabel)


When opening files with chinese characters in my Java 6 Application – the JLabel displayed squares instead of the proper filename:



log4j logged the filename correctly

Nytt 提供.docx

so I figured it was a font problem. I tried Arial, Verdana, Tahoma, Serif and so on. Nothing worked.


Then I tried this setting on the JLabel in Netbeans:



and this seems to resolve the issue!


The Java equivalent of the Netbeans setting is: