Home Java Example Java Swing Removing the Title Bar of a Frame

Related Tutorials


 
 

Share on Google+Share on Google+

Removing the Title Bar of a Frame

Advertisement
In this section, you will learn how to remove the title bar of a frame or window in java.

Removing the Title Bar of a Frame

     

In this section, you will learn how to remove the title bar of a frame or window in java. That means show the frame or window without title bar. The title bar of the frame or window which holds the icon, minimize button, maximize button and close button with the title of the frame. Following  is the image of the frame without title bar:

Frame Without Title Bar

Code Description:

setUndecorated(boolean):
This is the method of the JFrame class that sets the frame decoration. It takes a boolean typed value either true or false. If you passes the true then the frame will undecorated means the frame will not show the title bar and if you passes the false then the frame will show the title bar.

Here is the code of the program:

import javax.swing.*;

public class RemoveTitleFrame{
  public static void main(String[] args) {
  JFrame frame = new JFrame("Removing the Title Bar of a Frame");
  frame.setUndecorated(true);
  frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
  frame.setSize(400,400);
  frame.setVisible(true);
  }
}

Download this example.

Advertisements

If you enjoyed this post then why not add us on Google+? Add us to your Circles



Liked it!  Share this Tutorial


Follow us on Twitter, or add us on Facebook or Google Plus to keep you updated with the recent trends of Java and other open source platforms.

Posted on: April 14, 2007

Related Tutorials

Discuss: Removing the Title Bar of a Frame   View All Comments

Post your Comment


Your Name (*) :
Your Email :
Subject (*):
Your Comment (*):
  Reload Image
 
 
Comments:3
Rorroh
December 19, 2011
Thanks!

Thanks, this was just what I needed and was straight to the point!
hema ramana
April 5, 2012
Removing a Menu bar from frame

How Can remove menu bar from frame. Please send me code to my mail. Thanks&regards Hema ramana
Iran/Hamed
June 30, 2013
Thanks

frame.setUndecorated(true); Thanks!
DMCA.com