为什么我们的 Java 应用程序不会在辅助监视器上显示窗口?

发布于 2024-09-17 11:09:23 字数 379 浏览 7 评论 0原文

我们有一个 Java/Swing 客户端,它已经存在了好几年了。当我从 XP 迁移到 Vista(客户端仅在 Windows 上运行)时,我注意到每当在辅助监视器上创建新窗口(通常是 JFrame 后代)时,该窗口最初显示为空白,即而不是显示正常内容窗户,它只是一块灰色的实心块。如果我然后将该窗口拖动到主显示器上,那么它在越过显示器边界的那一刻,就会正确地自行绘制,我可以将其拖回辅助显示器。如果窗口是在主监视器上创建的,那么它总是会完美地存在。我在 XP 上从来没有遇到过这个问题,只在 Vista 上遇到过这个问题。由于缺少双显示器 Windows 7 机器,我无法在 Windows 7 上轻松测试它。

有人有任何想法吗?这可能是一个已知的 Java 错误吗?我还运行最新的 Java 1.6 SDK。

We have a Java/Swing client that's been around for quite a few years. When I moved from XP to Vista (client ONLY runs on Windows), I noticed that whenever a new window is created (usually a JFrame descendant) on my secondary monitor, the window initially shows as blank, i.e. instead of showing the normal contents of the window, it's just a solid block of gray. If I then drag that window onto the primary monitor, the second it crosses the monitor boundary, it draws itself properly and I can drag it back to the secondary monitor. If the window is created on the primary monitor, it always comes into existence perfectly. I NEVER had this problem on XP, only on Vista. I'm unable to easily test it on Windows 7, lacking a dual monitor Windows 7 machine.

Anybody have any ideas? Is this perhaps a known Java bug? I'm also running the most recent Java 1.6 SDK.

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

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

发布评论

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

评论(1

凶凌 2024-09-24 11:09:24

检查视频驱动程序和JRE是否是最新的。 (可以使用当前的 JDK,但使用旧的 JRE。)

Java 会将缓冲委托给 DirectDraw 和/或 Direct3D。您可以使用以下 JVM 选项禁用此功能:

  • -Dsun.java2d.d3d=false
  • -Dsun.java2d.noddraw=true

还有其他详细选项 此处

如果主显示器位于辅助显示器的右侧,则辅助显示器上的屏幕位置将具有负 X 值。 (同样,如果次要位置高于主要位置,则 Y 值将为负。)可能存在不处理负值的代码。

Check that the video driver and the JRE are up to date. (It is possible to have a current JDK, but an old JRE.)

Java will delegate the buffering to DirectDraw and/or Direct3D. You can disable this with the following JVM options:

  • -Dsun.java2d.d3d=false
  • -Dsun.java2d.noddraw=true

There are other options detailed here.

If the primary monitor is to the right of the secondary monitor, the screen positions on the secondary monitor will have negative X values. (Likewise if the secondary is above the primary positions will have negative Y values.) It is possible there is code that is not handling the negative values.

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