使用多显示器进行空白组件渲染
我正在开发一个 AWT 应用程序。它在单显示器上运行流畅。但是,当与多显示器设置一起使用时:
对话框经常打开空白:对话框大小的完全黑点,甚至顶部窗口系统图标也不会出现。一旦移动或对该空白部分执行任何操作(调整大小、移动等),内容就会正常显示。
当应用程序“放置”在辅助监视器上时。仅当出现上述问题时才会在主监视器上打开对话框。
尽管在 Win 7 中使用时该问题并不一致,但在 Windows XP 上更频繁地出现该问题。
这是像 this 和相关的标准 Java Bug 吗?
有什么解决方法吗?
I am developing an AWT application. It runs smoothly on single monitor. However, when used with a multiple monitor set up:
Often dialog boxes open blank: complete black spot the size of a dialog, even top window system icons do not appear. Once moved or after any action performed on that blank part - resize, move etc, content appears normally.
When application is "put" on secondary monitor. The dialogs open on primary monitor only with the issues described above.
Although the issue is not found to be consistent when used with Win 7, issues occur more frequently on Windows XP.
Is this a standard Java Bug like this and related ones?
Any workarounds?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我还遇到过一些多显示器问题:最值得注意的是,Robot 类在多显示器设置中的某些 JVM 上严重损坏。例如,当 OS X 系统连接多个显示器时,几乎不可能获得一致的屏幕截图。
好吧,如果您要求一种解决方法,那么您所描述的内容有一个明显的解决方法:如果任何移动/调整大小操作强制内容正常显示,那么您可以以编程方式触发假移动器或调整大小操作,可能解决您的问题。
在那里,我们做到了这一点:在一个应用程序中,我们必须使用一个(损坏的)第 3 方图形 API,该 API 已损坏显示问题。在一种情况下,除非我们调整窗口大小,否则图表不会正确显示:这是一个已知的错误,但尚未修复。我们的解决方案包括强制将窗口大小调整一像素。这是一个蹩脚的解决方法,但它确实有效。直到今天,我们还没有收到任何用户的抱怨(确实很难发现单像素的大小调整)。
我想再次强调,这是一种黑客攻击,但有时需要解决方法。我并不是说针对您的情况没有更好的解决方案。您要求解决方法,所以这是一个...
I've also encountered quite some multi-monitors issues: most notably the Robot class is badly broken on some JVMs in multi-monitors setup. For example it's darn near impossible to get consistent screenshots when there are multiple monitors hooked up to an OS X system.
Well if you ask for a workaround, there's an obvious one regarding what you described: if any move/resize action force the content to appear normally then you could programmatically trigger a fake mover or resize action which may be a workaround your problem.
Been there, done that: in one app we had to use a (broken) 3rd party graphing API that had broken displaying issues. In one case a graph wouldn't show up correctly unless we resized the window: it was a known bug but not fixed yet. Our solution consisted in forcing a one-pixel resize of the window. It's a crappy workaround, but it worked. To this day we haven't had a single user complaining (it's really very hard to spot a one-pixel resize).
I'd like to re-emphasis that this is a hack but, sometimes, workarounds are needed. I'm not saying that there's not a better solution in your cases. You asked for a workaround, so here's one...