为什么 JTree 叶子图标被替换为“项目符号”?
我在应用程序中进行了一些包和 jar 重构,现在我遇到了一些外观和感觉问题。 - 更容易解释的是,在 JTree(嵌入 JXTreeTable 中)中,我不再有“叶子”(文件)图标,而是灰色子弹...... - 另一个问题是 TextArea 中的默认字体变成了“Courier”,我不得不在 UIManager 中将其强制为正常字体才能恢复正常...
有没有人已经见过这个问题并知道为什么会发生以及如何修复它?
非常感谢。
I did some package and jar refactoring in my application and now I have several look&feel issues.
- The one which is easier to explain is that in JTree (embedded within a JXTreeTable), I no longer have "leaf" (file) icon but gray bullet instead...
- Another one is that the default font in TextArea became 'Courier', I hade to force it to a normal font in UIManager to go back to normal...
Has anyone seen this issue already and knows why it happens and how to fix it ?
Thanks very much.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
其中一个 jar 很可能正在改变(或不再改变)应用程序的外观和感觉。听起来您好像从 Java 外观转向了“Windows 默认”外观。您可以尝试自己设置外观和感觉,看看是否可以获得所需的结果。
如果只是叶子图标有问题并且您想解决它,则可以将图标更改为任何图像: http://download.oracle.com/javase/tutorial/uiswing/components/tree.html#display。
More than likely one of the jars is changing (or is no longer changing) the look and feel of the application. Sounds like you went from the Java look and feel to the "Windows Default" Look and feel. You can try setting the look and feel yourself and see if you can get the desired results.
If it is just the leaf icon that is the problem and you want to work around it, you can change the icon to any image: http://download.oracle.com/javase/tutorial/uiswing/components/tree.html#display.