Feb 11, 2012

[Netbeans] center a JFrame window

1. JFrame properties (right click on JFrame --> properties)
2. code tab  -->  Form size policy --> Generate resize code
3. be sure "Generate center" is checked.
4. close

without GUI,

    private static void createAndShowGUI() {
        //Create and set up the window.
        JFrame frame = new BabyZoo();

        //Display the window.
frame.setLocationRelativeTo(null);   //center the window

1 comment:

  1. I have read your blog its very attractive and impressive. I like it your blog.

    Java Training in Chennai Core Java Training in Chennai Core Java Training in Chennai

    Java Online Training Java Online Training Core Java 8 Training in Chennai Core java 8 online training JavaEE Training in Chennai Java EE Training in Chennai