• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Rob Spoor
  • Tim Cooke
  • Junilu Lacar
Sheriffs:
  • Henry Wong
  • Liutauras Vilda
  • Jeanne Boyarsky
Saloon Keepers:
  • Jesse Silverman
  • Tim Holloway
  • Stephan van Hulst
  • Tim Moores
  • Carey Brown
Bartenders:
  • Al Hobbs
  • Mikalai Zaikin
  • Piet Souris

Window Title Bar

 
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
Ranch Hand
Posts: 257
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 7
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 257
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Of course! Instead of using JWindow, just use java.awt.Window, that's it!
JWindow is a subclass of Window.
SAF
 
Raymond Fei
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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


 
Ranch Hand
Posts: 124
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 7
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi! Ashwin,
Thanks for your help. Your code works very well.
Raymond
 
Ranch Hand
Posts: 53
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
"The Hood"
Posts: 8521
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic