JLabel文本是乱码 [英] JLabel text is garbled
问题描述
我看到一个奇怪的问题涉及一个 JLabel
,用于显示一个范围的数字。标签的文本通常类似于 0.0 - 100.0 (例如)。问题是,对于选择几个用户,文本显示乱码。在此示例中,文本将显示为 / - /,0 // - / 。
/ p>
- 它似乎是某种类型的错误,因为每个显示的字符都是预期字符后的一个Unicode字符。
- 这两个数字之间的破折号字符在应用程序中作为字符串文字进行硬编码。
- 它在Oracle JVM的各种版本上发生,包括1.6.x
什么是可能会导致这种类型的问题?我还应该调查什么?感谢。
当您设置 JLabel
到Windows字体缓存中损坏的字体。
要重建缓存:以管理员身份删除此文件并重新启动计算机:
del%WINDIR%\System32\FNTCACHE.DAT
I'm seeing a strange issue involving a JLabel
that is used to display a range of numbers. The text of the label is typically something like 0.0 - 100.0 (for example). The problem is that for a select few users, the text appears garbled. In this example, the text would show up as /-/,0//-/.
Here's what I know so far:
- It appears to be some sort of off-by-one bug since each character displayed is one Unicode character behind the expected character.
- The dash character between the two numbers is hard-coded in the application as a string literal.
- It's happening on various versions of Oracle JVMs including 1.6.x and 1.7.x.
- It's happening on a few select Windows 7 machines.
What could cause this type of problem? What else should I investigate? Thanks.
This happens when you're setting the font of your JLabel
to a font corrupted in the Windows font cache.
To rebuild the cache: as administrator, delete this file and reboot the PC:
del %WINDIR%\System32\FNTCACHE.DAT
这篇关于JLabel文本是乱码的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!