• Post Reply Bookmark Topic Watch Topic
  • New Topic

how to set JFrame titlebar color  RSS feed

 
Rob Byrd
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Can anyone tell me how to change the color of the titlebar on a JFrame when the frame is active?
Thanks in advance.
 
Seema Sharma
Ranch Hand
Posts: 78
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Rob,
Use these lines of code to change the color of the titlebar.

 
Rob Byrd
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Seema,
The code you provided does not seem to work with JFrame. I notice that you use JDialog. Does this only work with JDialogs?
 
Campbell Ritchie
Sheriff
Posts: 53774
128
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It should work with JFrames, which have a set . . .Decorated method too.
 
Rob Byrd
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'm using an Apple computer and I suspect the Aqua LAF is causing the problem. Is this a possibility?
 
Campbell Ritchie
Sheriff
Posts: 53774
128
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Not familiar with Aqua LAF, but it is quite possible that is the problem, particularly if it doesn't change colour with activation.
Somebody like Brian Cole would probably know.
 
Seema Sharma
Ranch Hand
Posts: 78
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Rob,
Please check out this link. Hope it will help.

http://forum.java.sun.com/thread.jspa?threadID=5171154&messageID=9658560

Sorry, my code was for JDialog but it will work work for JFrame using:
JFrame.setDefaultLookAndFeelDecorated(true);

Regards,
Seema
 
Rob Byrd
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks to everyone for their help. I found a comment on the web to the effect that the Apple OS doesn't support what I wanted to do. That this might be true seems to be confirmed by your last post, Seema, regarding Windows.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!