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

前端 未结 7 1713
时光说笑
时光说笑 2020-12-21 16:54

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 r

相关标签:
7条回答
  • 2020-12-21 17:32

    If you want you Application to be Full Screen..Use Toolkit...

    Toolkit t = Toolkit.getDefaultToolkit();
    
    Dimension d = t.getScreenSize();
    
    int ScreenWidth = d.width;
    
    int ScreenHeight = d.height;
    
    myframe.setSize(ScreenWidth, ScreenHeight);
    
    myframe.setLocationByPlatform(true);
    
    0 讨论(0)
  • 2020-12-21 17:42

    Use this code on Constructor.

    setExtendedState(MAXIMIZED_BOTH);
    

    ater using this whatever frame i have designed, that components are not fix in center or means disbalanced all the content that are designed using netbeans drag and drop

    0 讨论(0)
  • 2020-12-21 17:43

    If you are using Netbeans then after initcomponent() method you can use this code, it will help you out:

    setExtendedState(MAXIMIZED_BOTH)
    
    0 讨论(0)
  • 2020-12-21 17:51

    I guess you are using JFrames for your App.

    // to start with
    JPanel myUI = createUIPanel();
    JFrame frame = new JFrame();
    frame.add(myUI);
    
    // .. and later ...
    
    JFrame newFrame = new JFrame();
    newFrame.setUndecorated();
    newFrame.add(myUI);
    
    0 讨论(0)
  • 2020-12-21 17:54

    Use this code in constructor

    setExtendedState(MAXIMIZED_BOTH);
    
    0 讨论(0)
  • 2020-12-21 17:56

    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).

    0 讨论(0)
提交回复
热议问题