Maximising a screen

Hi.
I would like my program to maximise itself on opening therefore making it fit the screen perfectly. Ne1 know if this is possible using java and how exactly i would go about doing it?
All help will be greatly appreciated!

Comments

  • : Hi.
    : I would like my program to maximise itself on opening therefore making it fit the screen perfectly. Ne1 know if this is possible using java and how exactly i would go about doing it?
    : All help will be greatly appreciated!
    :


    My group at school has just finished figuring this one out. All I can personally tell you is that YES it is possible, and that once done it will auto-fit to any screen size.
    Sorry I can't tell you HOW to do it, but that wasn't my area.
  • [code]
    import java.awt.Frame;
    import java.awt.Toolkit;

    import javax.swing.JFrame;

    public class MaxFrame extends JFrame {

    public MaxFrame() {
    setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

    Toolkit toolkit = Toolkit.getDefaultToolkit();
    boolean maxSupported =
    toolkit.isFrameStateSupported(Frame.MAXIMIZED_BOTH);
    if (maxSupported) {
    setExtendedState(Frame.MAXIMIZED_BOTH);
    } else {
    //can't max using this method, do something else
    }
    }

    public static void main(String[] args) {
    new MaxFrame().show();
    }
    }
    [/code]

    ---------------------------------
    [size=1](Its just my sig)
    HOWTO ask questions: http://catb.org/~esr/faqs/smart-questions.html[/size]

Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories