File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Swing / AWT / SWT and the fly likes Jframe default look and feel Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "Jframe default look and feel " Watch "Jframe default look and feel " New topic
Author

Jframe default look and feel

dushantha Rathnayake
Ranch Hand

Joined: Feb 27, 2010
Posts: 103
Hi,

I want to develop a transparent jframe. In that case I am using fallowing code example. But the problem is I want to remove the title bar of the jframe. To transparent the jframe, it needs default look and feel as true. So my question is, how can remove the title bar of jframe when it's with default look and feel mode?



Thank you.
Kemal Sokolovic
Bartender

Joined: Jun 19, 2010
Posts: 825
    
    5

Check setUndecorated in the API:

Disables or enables decorations for
this frame. This method can only be
called while the frame is not
displayable.


The quieter you are, the more you are able to hear.
Michael Dunn
Ranch Hand

Joined: Jun 09, 2003
Posts: 4632
setUndecorated()
use a JWindow()
dushantha Rathnayake
Ranch Hand

Joined: Feb 27, 2010
Posts: 103
Hi,

Thank you all for the reply's. I tried with the setUndecorated as true. But it's not working. K i will try with the JWindow. Any other solutions??

Thank you.
Darryl Burke
Bartender

Joined: May 03, 2008
Posts: 4664
    
    5

dushantha Rathnayake wrote:I tried with the setUndecorated as true. But it's not working.

SSCCE or it didn't happen. setUndecorated(true) always works as documented.


luck, db
There are no new questions, but there may be new answers.
Kemal Sokolovic
Bartender

Joined: Jun 19, 2010
Posts: 825
    
    5

dushantha Rathnayake wrote:I tried with the setUndecorated as true. But it's not working.

I have used it couple of times, and it always worked. As the API says, make sure you invoke it before you actually display your frame. Can we see some of the code you are working with, please?
dushantha Rathnayake
Ranch Hand

Joined: Feb 27, 2010
Posts: 103
Hi,

I mean if I set setDefaultLookAndFeel as true and set setUndecoration as true but it's not working. Actually want to do transparent the background frame without its content. After transparent the frame I can put a JLabel and set image icon. so the UI will be the image. Please see the image fallowing.

Thank you.


[Thumbnail for transparent.png]

[Thumbnail for transparent.png]

m Korbel
Ranch Hand

Joined: Jun 19, 2012
Posts: 157
another issue to remove empty space, use LayoutManagers and call pack() before JFrame#setVisible(true)

Darryl Burke
Bartender

Joined: May 03, 2008
Posts: 4664
    
    5

dushantha Rathnayake wrote:I mean if I set setDefaultLookAndFeel as true and set setUndecoration as true but it's not working.


Darryl Burke wrote:SSCCE or it didn't happen. setUndecorated(true) always works as documented.
Kemal Sokolovic
Bartender

Joined: Jun 19, 2010
Posts: 825
    
    5

I will ask the same question I asked a week ago - can we see the code you are now working with?
Michael Dunn
Ranch Hand

Joined: Jun 09, 2003
Posts: 4632
it seems the
JFrame.setDefaultLookAndFeelDecorated(true);
overrides
setUndecorated(true);

in place of setUndecorated(true);
add these lines

getLayeredPane().remove(getLayeredPane().getComponent(1));//removes titlebar
getRootPane().setBorder(null);//removes border

works OK in java 1.6, but future releases ??
dushantha Rathnayake
Ranch Hand

Joined: Feb 27, 2010
Posts: 103
Hi,


Ok guys. I'm going to post the real code.



Thank you.
Darryl Burke
Bartender

Joined: May 03, 2008
Posts: 4664
    
    5

Earlier you said, and I quote from that post:
dushantha Rathnayake wrote:if I set setDefaultLookAndFeel as true and set setUndecoration as true
Now it's
dushantha Rathnayake wrote:

Do you see what you didn't tell us?

Michael's advice notwithstanding, why on earth would you even want to setDefaultLookAndFeelDecorated(true) when you what you want is an undecorated JFrame?
m Korbel
Ranch Hand

Joined: Jun 19, 2012
Posts: 157
Darryl Burke wrote for why on earth would you even want to setDefaultLookAndFeelDecorated(true) when you what you want is an undecorated JFrame?


right counterproductive, great minds thinks alike !!!
dushantha Rathnayake
Ranch Hand

Joined: Feb 27, 2010
Posts: 103
Hi,

Ok guys, If I done any wrong, Please sorry for that. Actually I want to get the fallowing UI. Please help me to develop it.

Thank you.


[Thumbnail for Untitled.png]

 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Jframe default look and feel