Search This Blog

How to Remove Title bar from JFrame of Java Application

To remove the title bar completely, there is a method called setUndecorated() in java. It takes a boolean variable. If the boolean is true, the title bar will be removed. The following one is an example. The method setUndecorated() invoked with a true boolean argument, will remove the title bar from the JFrame MyJFrame. The method is called here from the constructor. You may call it anywhere from within the class scope.
public class MyJFrame extends JFrame{
         public MyJFrame()
           {

           setUndecorated(true);
           }
}
After removing title bar, you may add your own buttons for closing, maximization and minimization of the window.

No comments:

Post a Comment