Results 1 to 5 of 5

Thread: Remove Title Bar of a Frame in Java

  1. #1
    Join Date
    Nov 2009
    Posts
    652

    Remove Title Bar of a Frame in Java

    Hi, I want to create a frame which does not contain the title bar. Can it be possible? If yes then please reply me with the source code of it. I need this source code as soon as possible.

  2. #2
    Join Date
    Apr 2008
    Posts
    1,948

    Re: Remove Title Bar of a Frame in Java

    Hi, you need to use the following code to remove the title bar form the frame. It will solve your problem.
    Code:
    import javax.swing.*;
    
    public class titlebarremover
    {
      public static void main(String[] args) 
    {
        JFrame frame = new JFrame("Remove Title Bar of a Frame");
        frame.setUndecorated(true);
        frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        frame.setSize(200,200);
        frame.setVisible(true);
      }
    }

  3. #3
    Join Date
    May 2008
    Posts
    2,012

    Re: Remove Title Bar of a Frame in Java

    Hi, I am giving you a code which will remove the title bar of a frame in java by using the java.awt package.

    Code:
    import java.awt.*;
    import java.awt.event.*;
    
    public class WithoutTitleFrame
    {
      public static void main(String[] args)
    {
        Frame frame = new Frame("Without Title Bar Frame");
        Label lbl = new Label("Welcome techarena solutions forum",Label.CENTER);
        frame.setUndecorated(true);
        frame.add(lbl);
        frame.setSize(800,800);
        frame.setVisible(true);
        frame.addWindowListener(new WindowAdapter()
         {
          public void windowClosing(WindowEvent we)
         {
            Frame frame = (Frame)we.getSource();
            frame.dispose();
          }
        });
      }
    }

  4. #4
    Join Date
    Apr 2008
    Posts
    2,005

    Re: Remove Title Bar of a Frame in Java

    Hello, you want to Remove Title Bar of a Frame in Java, then it is very easy, just use one method, as I have done follow:

    Code:
    import java.awt.Frame;
    
    public class Main 
    {
      public static void main() 
      {
        Frame frame = new Frame();
        frame.setUndecorated(true);   
        boolean undecorated = frame.isUndecorated();
      }
    }

  5. #5
    Join Date
    May 2008
    Posts
    2,297

    Re: Remove Title Bar of a Frame in Java

    Hi, there is a way in java to remove the title bar and other decorations from a frame. A frame looks and behave like a window container without decorations. But if you don't want the title bar then it is better to use a Window container. You can remove the decorations while the frame is not visible. To remove those decorations just make use of following method:

    Code:
     Frame applicationframe = new Frame();
        applicationframe.setUndecorated(true);

Similar Threads

  1. What is the use of Frame class in java?
    By Truster in forum Software Development
    Replies: 5
    Last Post: 25-02-2010, 11:16 AM
  2. Remove The Title Bar Of A JDialog
    By ramsun in forum Software Development
    Replies: 5
    Last Post: 27-01-2010, 01:07 PM
  3. Java program code for frame
    By Sarfaraj Khan in forum Software Development
    Replies: 5
    Last Post: 08-01-2010, 11:02 AM
  4. Frame constructor in java
    By HardWeaR in forum Software Development
    Replies: 3
    Last Post: 08-12-2009, 02:46 PM
  5. How to create button on frame in java?
    By JagdishP in forum Software Development
    Replies: 4
    Last Post: 10-08-2009, 06:04 PM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Page generated in 1,715,599,908.45991 seconds with 17 queries