可执行Jar的画布比使用Eclipse Runner的画布小 [英] Executable Jar has a Smaller Canvas than using the Eclipse Runner

查看:103
本文介绍了可执行Jar的画布比使用Eclipse Runner的画布小的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正试图将我的项目导出为可执行的jar文件,但是由于某种原因,框架中的画布上的绘制框架变小了。换句话说,从我在1080p的Eclipse上运行时,屏幕以某种方式变小了(1536 x 864)。



我想也许是编译器或。 jar导出可能是问题,所以我尝试使用IntelliJ Idea,但得到了相同的结果:编译器中为1080p,但从.jar运行1536 x 864。

所以下面的代码会产生以下描述的结果:

  GraphicsDevice device = GraphicsEnvironment 
.getLocalGraphicsEnvironment()。 getDefaultScreenDevice();
// device.getDisplayMode()返回1920 x 1080和其他一些统计信息
// device.getDefaultConfiguration()。getBounds()从Eclipse(或IntelliJ)运行时返回1920 x 1080,但返回1536 x从导出的.jar文件运行864。

我希望.jar文件仍为1080p,而不是更改为较小的尺寸。我认为问题可能出在我的计算机上,但我不知道如何检查。我无法在另一台计算机上复制此问题,但将进行更多检查。如果需要,我很乐意提供任何图片;我暂时无法。任何帮助将不胜感激!



注意:这是另一个问题的扩展,可能会在我部分解决问题的地方有所帮助为什么Java Fullscreen Exclusive Mode无法运行我的最大屏幕分辨率?。最初的问题是,即使在Eclipse中,我的屏幕尺寸也比预期的要小。部分解决方案是我将工作空间环境从版本11恢复到Java版本1.8。



为澄清起见:问题围绕GraphicsDevice以及我对Canvas and Frame的引用



编辑2:基于上一个问题的潜在解决方案是Java解释器可能存在问题。 Eclipse试图使用Java版本11解释代码,所以也许我的计算机试图使用版本11解释Java。我不知道它是如何工作的,但是也许我可以尝试在计算机上卸载Java 11版本的所有实例。 p>

编辑3:编辑2有效。我卸载了版本11,并连接了版本1.8,一切运行良好:)

解决方案

如果这可以帮助任何人:
编辑问题的第3条。


I'm trying to export my project as an executable jar file but for some reason, the frame of drawing on the Canvas in a Frame became smaller. In other words, the screen somehow became smaller (1536 x 864) from when I ran it from Eclipse where it was 1080p.

I have thought that maybe the compiler or .jar export may be the issue so I tried using IntelliJ Idea but got the same results: 1080p in the compiler but 1536 x 864 running from the .jar

So the code below would produce the described results:

GraphicsDevice device = GraphicsEnvironment
         .getLocalGraphicsEnvironment().getDefaultScreenDevice();
// device.getDisplayMode() returns 1920 x 1080 and some other stats
// device.getDefaultConfiguration().getBounds() returns 1920 x 1080 when run from Eclipse (or IntelliJ) but returns 1536 x 864 when ran from the exported .jar file.

I would like the .jar file to still be in 1080p instead of changing to a smaller size. I'm thinking that the issue may lie in my computer itself but I have no clue how to check this or not. I could not replicate this issue on one other computer but will be checking more. I would be happy to supply any pictures if requested; I can't at the moment. Any help would be greatly appreciated!

Note: This is an extension of another question that may be helpful where I partially resolved the issue Why isn't Java Fullscreen Exclusive Mode running my max screen resolution?. The original problem was that even in Eclipse I had a smaller screen size than anticipated. The partial solution was that I reverted my workspace environment to Java version 1.8 from version 11.

Edit for Clarification: The issue surrounds the GraphicsDevice and my reference to the Canvas and Frame is just an example of what's going on.

Edit 2: A potential solution that is based on the previous question is that there may just be an issue with the Java interpreter. Eclipse was trying to interpret the code using Java version 11 so maybe my computer is trying to interpret Java using version 11. I don't know how it works but maybe I can try uninstalling all instances of Java 11 versions on my computer.

Edit 3: Edit 2 worked. I uninstalled version 11 and hooked up version 1.8 and everything ran well :)

解决方案

In case this helps anyone: Edit 3 of the question worked.

这篇关于可执行Jar的画布比使用Eclipse Runner的画布小的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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