Search code examples
javanetbeansplatform

How to set full Screen Mode of My App which is made in netbeans platform?


I m made Desktop App in netbeans platform in java.now wwhen i run my app it will open by default size of netbeans platform configuration.but i want full screen mode when i run or startup my app. so where and how to do that in my app?


Solution

  • If you want to open the JFrame maximized by default in swing you can use JFrame. setExtendedState(), illusrated below:

    public class MyFrame extends JFrame{ 
       public MyFrame() {
    
           // Other codes 
    
           // Set the JFrame to maximize by default on opening
           setExtendedState(JFrame.MAXIMIZED_BOTH);        
    
           // Rest of the program
        }
    }
    

    Also remember that you should not have JFrame.pack() or JFrame.setMaximimumSize() or JFrame.setSize() in the same menthod (here constructor).