Wednesday, February 25, 2009

JFrame without Title Bar

JFrame is the most widely used GUI frame is Stand alone applications. Often coders need to display JFrame windows without the title bar. This code snippet shows how you can accomplish that.

JFrameTitleBarTest.java

import javax.swing.*;

/**

 * @author Shazin Sadakath

 *

**/

public class JFrameTitleBarTest{

              public static void main(String[] args){

                           JFrame jframe = new JFrame(”JFrame Title Bar Test”);

                           jframe.setDefaultCloseOperation(jframe.EXIT_ON_CLOSE);

                           jframe.setUndecorated(true);

                           jframe.setSize(400,400);

                           jframe.setLocationRelativeTo(null);

                           jframe.setVisible(true);

            }

}


No comments:

Post a Comment