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

女生的网名这么多〃 提交于 2019-12-18 09:11:40

问题


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?


回答1:


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




回答2:


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




回答3:


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



回答4:


Use this code in constructor

setExtendedState(MAXIMIZED_BOTH);



回答5:


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



回答6:


Toolkit tk = Toolkit.getDefaultToolkit();
    int xsize = (int) tk.getScreenSize().getWidth();
    int ysize = (int) tk.getScreenSize().getHeight();
    this.setSize(xsize, ysize);



回答7:


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

setExtendedState(MAXIMIZED_BOTH)


来源:https://stackoverflow.com/questions/11311764/how-to-set-full-screen-mode-of-my-app-which-is-made-in-netbeans-platform

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!