JFileChooser 具有 Windows7 外观和感觉缺少按钮

发布于 2024-08-22 02:40:31 字数 314 浏览 2 评论 0原文

我使用以下代码成功在 Windows 外观中创建了 JFileChooser

try {
        UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
    } catch (Exception e) {     }

但当 JFileChooser 出现时,它缺少文件名下拉菜单右侧的按钮。缺少的按钮是上一级、创建新文件夹、列表视图和详细信息视图按钮。

关于如何让它们回来有什么想法吗?

谢谢!

I succeeded in creating a JFileChooser in the windows look and feel with the following code

try {
        UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
    } catch (Exception e) {     }

But when the JFileChooser comes up, it is missing buttons to the right of the drop-down menu of file names. The buttons that are missing are the up one level, create new Folder, list view, and details view buttons.

Any ideas on how I can get them back?

Thanks!

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(5

荭秂 2024-08-29 02:40:31

JFileChooser 不是本机对话框。事实上,Swing 中什么都不是。

如果您想要本机控件和对话框,则需要使用 SWT 而不是 Swing。

JFileChooser isn't a native dialog. In fact, nothing in Swing is.

If you want native controls and dialogs, you need to use SWT instead of Swing.

眼角的笑意。 2024-08-29 02:40:31

这似乎是我的计算机的一个特殊问题 - 当我在其他计算机上运行此程序时,会出现按钮。去算算吧。

It seems to be a particular problem with my computer - when I run this program on other computers, the buttons appear. Go figure.

来日方长 2024-08-29 02:40:31

我在 JRE 1.6.0 update 18 中遇到了同样的问题。显然,这是一个错误: 错误 ID:6840086 JFileChooser 在 Windows 7 上运行时右上角缺少图标

该错误已在最新版本的 JRE:1.6.0 update 22 中修复。

I've got the same problem with JRE 1.6.0 update 18. Apparently, this is a bug: Bug ID: 6840086 JFileChooser lacks icons on top right when running on Windows 7.

This bug has been fixed in the latest version of JRE: 1.6.0 update 22.

浅语花开 2024-08-29 02:40:31

你确定没有任何异常吗?也许将 e.printStackTrace() 放在 catch 块中只是为了 100% 确保没有异常

Are you sure there are no exceptions spitted out ? Perhaps put a e.printStackTrace() in the catch block just to be 100% sure that there are no exceptions

岛歌少女 2024-08-29 02:40:31

该问题在 1.6_0.25-b06 上仍然发生。我在 Oracle 论坛上创建了一个线程

添加

我遇到此问题是因为 NetBeans 指向 JDK 1.6.13 目录。我必须安装 JDK 1.6.25 并更新 netbean 的配置文件+重新启动 NetBeans。

The issue still happens on 1.6_0.25-b06. I have created a thread on Oracle's forum.

ADDITION

I had this issue because NetBeans was pointing to JDK 1.6.13 directory. I had to install JDK 1.6.25 and update netbean's config file + reboot NetBeans.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文