Java Swing 组件在第二个屏幕上出现黑色错误 [英] Java Swing component black on second screen bug

查看:39
本文介绍了Java Swing 组件在第二个屏幕上出现黑色错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在 Java Swing 中开发了一个稍微简单的 GUI,但出于某种原因,我看到了一些令人毛骨悚然的行为.

I developed a somewhat simple GUI in Java Swing, and for some reason I am seeing some spooky behaviour.

在一台电脑上,当在笔记本电脑自己的屏幕上打开摆动窗口时,它看起来正常,但当移动到第二个屏幕时,它变成全黑,即使部分在一个屏幕上,部分在另一个屏幕上,它也能正确显示笔记本电脑屏幕和另一个黑色.

On one computer when the swing window is open on the laptop's own screen it looks normal, but when moved to the second screen it turns completely black, even when it is partly in one and partly in the other it is shown correctly on the laptop screen and black on the other.

我无法在我自己的电脑上重现它(即使我有三个屏幕),所以我想问问其他人是否有类似的经历.

I can not reproduce it on my own computer (even though I have three screens), so I wanted to ask if anyone else has had similar experiences.

一个原因可能是笔记本电脑和第二个屏幕具有不同的颜色深度,这很麻烦.

One idea to a reason could be that the laptop and second screen has different color depths, and that is messing with it.

任何有关其发生原因的指示以及解决方案将是最受欢迎的.

Any pointers as to why it happens and a solution would be most welcome.

推荐答案

我刚刚在我的辅助显示器上尝试使用 Freemind 时目睹了相同的行为.一个快速的谷歌似乎表明这是一个 Java 错误.更多上下文:

I just witnessed the same behavior when trying to use Freemind on my secondary monitor. A quick Google seems to indicate that it's a Java bug. More context :

  • JRE 1.8.0_121(最新版本)
  • Windows 10
  • 无论第二个显示器是配置在主显示器的左侧还是右侧,都会发生错误(因此可能不是负屏幕坐标的问题)
  • 真正令人毛骨悚然的是,如果我将窗口拖到辅助监视器足够慢,FreeMind 会正确显示,所以可能存在与刷新率相关的问题.
  • 该问题可能与在每台显示器上设置的缩放系数有关(主显示器为 125%,辅助显示器为 100%),因为当我将其从一台显示器移动到另一台显示器时,窗口会明显调整大小
  • JRE 1.8.0_121 (latest version)
  • Windows 10
  • the bug happens whether the second monitor is configured on the left or on the right of the primary monitor (so probably not an issue with negative screen coordinates)
  • the really spooky part is that FreeMind displays properly if I drag the window to the secondary monitor slowly enough so maybe there's an issue linked to refresh rates.
  • the issue may be linked to the zoom factor set up on each monitor (125% on my primary vs 100% on my secondary) as the window visibly resizes when I move it from one monitor to the other

希望这会有所帮助.

注意:这应该是评论而不是答案,但我还没有足够的声望点数 ;)

NB: this should be a comment rather than an answer, but I don't have enough reputation points yet ;)

对于那些仍然在这个问题上磕磕绊绊的人:在同一台 PC 上,经过一些软件更新后,该错误已消失.我现在运行的是 JRE 1.8.0_144、Windows 10 Pro 1709(内部版本 16299.371).我最好的办法是 Windows 更新解决了这个问题;对于旧版/Java 应用程序(JMeter、Gimp),窗口大小调整和缩放系数现在比一年前要好得多.

For those still stumbling on this: on the same PC, the bug has disappeared after some software updates. I'm now running JRE 1.8.0_144, Windows 10 Pro 1709 (build 16299.371). My best bet is that a Windows update fixed the issue; window resizing and zoom factors now work much better than a year ago for legacy/Java applications (JMeter, Gimp).

这篇关于Java Swing 组件在第二个屏幕上出现黑色错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆