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 :)