使用 Substance LAF,Java 窗口无法在没有任务栏的屏幕上正确最大化
我刚刚注意到,当我在第二个屏幕(没有任务栏)上最大化一个框架时,它最终会达到大约与任务栏存在时预期的边界。
我刚刚注意到这一点已切换到 Windows 7。以前在 Vista 中,我有一个实用程序可以将任务栏添加到两个屏幕,因此如果情况并非如此,这也可能是一个问题。我很确定这在我尝试过的几个窗口管理器的 Linux 中不是一个问题...
如果我使用默认的 LAF 运行我的程序,那么就会表现出正确的行为(使用完整的水平空间)屏幕)。我认为 StackOverflow 并不是提交 Substance 错误报告的最佳地点,但如果有人可以提出补救措施,或者确认它确实是一个错误并帮助确定它发生的情况,我们将不胜感激。
编辑:我刚刚对源代码进行了一些挖掘,发现了一些对 issue 213;这正是我现在遇到的缺陷,据称该缺陷在当时(早在 2007 年)就已修复,并且据报告在 XP 和 Windows 中可以正常工作。具有现代建筑的 Vista (4.1)。我可能会在某个时候尝试调试相关的代码;看起来相当容易管理。
/风滚草
I've just noticed that when I maximise a frame on my second screen - which has no taskbar - then it ends up with approximately the bounds one would expect if the taskbar was there.
I've just noticed this having switched to Windows 7. Previously in Vista, I had a utility to add a taskbar to both screens, so this may have been an issue there as well if that were not the case. I'm pretty sure this hasn't been an issue in Linux with a couple of window managers that I've tried...
If I run my program with the default LAF, then the proper behaviour is exhibited (using the full horizontal space of the screen). I suppose StackOverflow isn't really the best place to file a Substance bug report, but if anyone can suggest a remedy, or confirm that it is indeed a bug and help to identify the circumstances under which it occurs it would be much appreciated.
edit: I've just been digging through the source code a bit and found some references to issue 213; precisely the defect I'm now experiencing, which was supposedly fixed at the time (back in 2007) and reported to be working correctly in XP & Vista with a contemporary build (4.1). I might try to debug the relevant bits of code at some point; looks fairly manageable.
/tumbleweed
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我想说,如果它只发生在 LaF 物质上,那么它听起来绝对是一个你应该报告的错误……但我在发布之前刚刚看到了你的编辑。祝你好运,四年后说服他们修复它!
与此同时,您可以尝试的唯一真正的解决方法是获取当前显示的插图并以这种方式设置大小。下面是一些代码,用于计算每台显示器上的分辨率、边界和可用空间:
在像我这样的双屏 Windows 设置上,这显示了以下内容:
注意显示器底部的 30 像素插图1.
现在您需要做的就是弄清楚您的应用程序正在哪个屏幕上运行。如果您的应用程序窗口是
JFrame
或Window
的任何其他子类,您可以使用Window.getGraphicsConfiguration()
获取活动屏幕的图形配置代码>.我希望这会有所帮助(也许它会帮助那些致力于解决 Substance bug 的人!)
I was going to say, if it's only occurring with the Substance LaF, then it definitely sounds like a bug that you should report... but I just saw your edit before posting. Good luck with persuading them to fix it after 4 years!
In the meantime, the only real workaround you could try is getting the insets of the current display and setting the size that way. Here's some code which works out the resolution, bounds and how much usable space is available on each of your monitors:
On a dual-screen Windows setup like I have, this shows the following:
Notice the 30-pixel insets at the bottom of monitor 1.
Now all you need to do is work out what screen your application is running on. You can use
Window.getGraphicsConfiguration()
this to get the graphics configuration for the active screen if your application window is aJFrame
or any other subclass ofWindow
.I hope that helps (and perhaps it will help the people working on the Substance bug!)