开发者

Set the Size of a FrameView programmatically

I am making a Desktop Application using Netbeans 6.8. What I would like to do is to programmatically set the size of my Application so that it fills the entire screen. I have looked around and it seems to be quite a nasty problem. I have been trying the code shown here, but it 开发者_开发知识库doesn't seem to be working.

Anyone has any idea on how I can solve it?


Thanks guys, it seems that all I needed was to mix the answers given above. I am answering this question so that I can put in some formatted code so that it will be easier to understand should someone stumble upon this post :)

    super(app);
    JFrame frame = new JFrame();
    frame.pack();
    frame.setExtendedState(JFrame.MAXIMIZED_BOTH);
    frame.setResizable(false);
    this.setFrame(frame);
    initComponents();

I basically created another JFrame and set it as the FrameView's JFrame before the initComponents method.


The FrameView has JFrame component, so you shouldn't recreate the JFrame.

super(app);

initComponents();

getFrame().setExtendedState(JFrame.MAXIMIZED_BOTH);
getFrame().setResizable(false);


If you are using a JFrame then try calling:

   setExtendedState(Frame.MAXIMIZED_BOTH);

on your FRame.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜