简体   繁体   中英

How to Make a windows application (jframe) full size

I am trying to create a windows application project. That time I am using some code for the full screen but it can't set. how to solve this problem.

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

 public Login() {
        initComponents();
       JFrame frame = new JFrame();
        frame.setExtendedState(JFrame.MAXIMIZED_BOTH); 
       frame.setUndecorated(true);
        frame.setVisible(true); 
    }

output comes but has some bugs.

Finally, I got the answer to the problem.

public Login() {
        initComponents();
        this.setExtendedState(JFrame.MAXIMIZED_BOTH); 
    }

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