简体   繁体   中英

Increasing Screen Resolution in java

I've noticed that the standard screen dimensions for a java window (using Panel or JFrame) are in the range of about 1200x800 (so about a million pixels). The laptop I'm using has about 4 million pixels (about 2500x1600).

A. Why does java condense and pixelate the screen like this? Is it just JFrame/JPanel?

B. How do I get a window with a resolution that automatically matches the screen's maximum resolution (preferably still in swing)?

To receive the size of the monitor you'll use this code:

Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();
int width = screenSize.getWidth();
int height = screenSize.getHeight();

To set the size of a frame you'll use this code:

jframe.setSize(witdh, height);

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM