简体   繁体   中英

How To Overlap The Taskbar On JFrame

I am wondering if you could overlap the taskbar with a JFrame. If it is possible, how can I do it? My code makes the JFrame maximized, but still shows the taskbar. This is my code:

JFrame f = new JFrame();
f.setExtendedState(JFrame.MAXIMIZED_BOTH);
f.setUndecorated(true);
f.setVisible(true);

You can, but you'd end up with the frame been wrapped under the taskbar.

GraphicsEnvironment ge = GraphicsEnvironment.getLocalGraphicsEnvironment();
GraphicsDevice gd = ge.getDefaultScreenDevice();
GraphicsConfiguration gc = gd.getDefaultConfiguration();
Rectangle bounds = gc.getBounds();

JFrame f = new JFrame();
f.setUndecorated(true);
f.setBounds(bounds);
f.setVisible(true);

Another choice might be to use Full-Screen Exclusive Mode API , based on the fact that you are making the frame undecoreated, this might be what you're after

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