aspose file tools
The moose likes Java in General and the fly likes Window Title Bar Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login
JavaRanch » Java Forums » Java » Java in General
Reply Bookmark "Window Title Bar" Watch "Window Title Bar" New topic
Author

Window Title Bar

Raymond Fei
Greenhorn

Joined: Jun 29, 2001
Posts: 7
I am developing an application software. I need get rid of window title bar. The only way I know is to put a window container on the frame to cover the title bar. I wonder if there are some other better way to do it. I wish to be able to create a frame without title bar.
Thanks for any suggestion.
SAFROLE YUTANI
Ranch Hand

Joined: Jul 06, 2001
Posts: 257
You can! Just create an instance of JWindow. The only difference between JFrame and JWindow is that JFrame has a title bar, and JWindow does not.
A JWindow is a container that can be displayed anywhere on the user's desktop. It does not have the title bar, window-management buttons, or other trimmings associated with a JFrame, but it is still a "first-class citizen" of the user's desktop, and can exist anywhere on it.
Splash screens are usually implemented using the likes of JWindow because you dont want a title bar in that case either.
SAF
Raymond Fei
Greenhorn

Joined: Jun 29, 2001
Posts: 7
Hi! SAFROLE YUTANI,
I really appreciate your reply and I will remember the way you tell me. But I have to use AWT and I can't use any SWING GUI Component in my codes because my code will run in a small embeded CPU. I have to save the resource as much as I can. The Swing take more resource than awt does, which is why I can't use it. Do you know any other way to solve this problem in AWT?
Thanks a lot!
Raymond
SAFROLE YUTANI
Ranch Hand

Joined: Jul 06, 2001
Posts: 257
Of course! Instead of using JWindow, just use java.awt.Window, that's it!
JWindow is a subclass of Window.
SAF
Raymond Fei
Greenhorn

Joined: Jun 29, 2001
Posts: 7
Hi! SAFROLE YUTANI,
I wrote a simple code for testing your way. But It seemed to me that your way doesn't work very well. I have to use Frame as a top-level window. Java compiler doesn't allow me to use Window as a top-level window. How can I get rid of the title bar on the top of the frame?
Hope somebody can help me sole this problem.
Thanks,
Raymond
/*********Test.java***********/
import java.awt.*;
public class Test extends Frame //Window
{
public Test(){
setSize(300,300);
Panel p = new Panel();
p.add(new Button("Test"), BorderLayout.CENTER);
add(p);
}
public static void main(String args[]){
Test t = new Test();
t.setVisible(true);
}
}
Originally posted by SAFROLE YUTANI:
Of course! Instead of using JWindow, just use java.awt.Window, that's it!
JWindow is a subclass of Window.
SAF

Ashwin Desai
Ranch Hand

Joined: Jul 17, 2000
Posts: 124
Try this out.

A window needs a parent Frame as its owner. Thus, create a dummy frame and use it as the owner when constructing the window.
Hope this helps.
Ashwin.

[This message has been edited by Ashwin Desai (edited July 16, 2001).]
Raymond Fei
Greenhorn

Joined: Jun 29, 2001
Posts: 7
Hi! Ashwin,
Thanks for your help. Your code works very well.
Raymond
parul patidar
Ranch Hand

Joined: Sep 07, 2001
Posts: 53
hi Ashwin i tried ur code but it show some strancge behaviour
when i run thatr prog through free java ide it shows a title bar less window but when i return to desktop window disappears
on desktop if i open any other window say my computer and immediately close it, ur window again appears
also when i click process window of free java window does not go back it remain in front until i don't click title bar of free java ide's process window
why all this is happening
Cindy Glass
"The Hood"
Sheriff

Joined: Sep 29, 2000
Posts: 8521
In the 1.4 release the Frame class has a setUndecorated() method to remove the titlebar and border etc. Then you can use the setDefaultLookAndFeelDecorated() to add in your own custome decorations if you want.

"JavaRanch, where the deer and the Certified play" - David O'Meara
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Window Title Bar
 
Similar Threads
Is there a way to make a window (no frame) and add my own components to it?
dragging Frame ?
How to avoid dragging the Frame by clicking TitleBar?
How to remove Frame/Window Title Bar
How to Create toolbar window?