• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Jframe default look and feel

 
dushantha Rathnayake
Ranch Hand
Posts: 103
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 825
5
Java Python Ruby
  • 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Check setUndecorated in the API:

Disables or enables decorations for
this frame. This method can only be
called while the frame is not
displayable.
 
Michael Dunn
Ranch Hand
Posts: 4632
  • 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
setUndecorated()
use a JWindow()
 
dushantha Rathnayake
Ranch Hand
Posts: 103
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 5115
11
Java Netbeans IDE Opera
  • 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Kemal Sokolovic
Bartender
Posts: 825
5
Java Python Ruby
  • 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 103
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
transparent.png
[Thumbnail for transparent.png]
transparent.png
[Thumbnail for transparent.png]
 
m Korbel
Ranch Hand
Posts: 174
  • 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
another issue to remove empty space, use LayoutManagers and call pack() before JFrame#setVisible(true)

 
Darryl Burke
Bartender
Posts: 5115
11
Java Netbeans IDE Opera
  • 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 825
5
Java Python Ruby
  • 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 4632
  • 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 103
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,


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



Thank you.
 
Darryl Burke
Bartender
Posts: 5115
11
Java Netbeans IDE Opera
  • 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 174
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 103
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
Untitled.png
[Thumbnail for Untitled.png]
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic