简体   繁体   中英

How can I prevent a Jframe from overlapping with taskbar in Windows 8.1?

I need a Jframe to be set as fullscreen on startup, but when I do so, it overlaps with taskbar.

I watched this post:

Setting a JFrame without overlapping with taskbar

But I am still not able to have the Jframe fullsize not overlapping taskbar on Windows 8.1.

The constructor of my main Jframe looks like this:

public Principal(Conexion c) throws SQLException {
    initComponents();
    GraphicsConfiguration config = getGraphicsConfiguration();
    Rectangle usableBounds = SunGraphicsEnvironment.getUsableBounds(config.getDevice());
    setMaximizedBounds(usableBounds);
    setExtendedState(MAXIMIZED_BOTH);
}

Is there any solution for this issue?

see follow code may help you

public NewJFrame() {
    initComponents();
    this.setResizable(true);
    this.setExtendedState(JFrame.MAXIMIZED_BOTH);

}

if you use netbeans then tick true on Resizable

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