Win a copy of The Java Performance Companion this week in the Performance forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Click in JFrame Titlebar sets the JFrame Opaque

 
Tim Alvord
Greenhorn
Posts: 23
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
I have a JFrame that I would like to set Opaque when the MouseButton is held down on the TitleBar and moved and returns to solid when released. I have two problems.

(1) The only way I could get the Opacity to work was by setting: JFrame.setDefaultLookAndFeelDecorated(true); This works but changes the Titlebar to a really ugly non-Windows look and feel Titlebar. Would like it to work without changing the Windws look and feel.
(2) Second problem is that when I click on the Titlebar, I cannot move the JFrame.


 
Michael Dunn
Ranch Hand
Posts: 4632
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
> I have a JFrame that I would like to set Opaque when the MouseButton is held down on the TitleBar and moved and returns to solid when released.

you might get it to work by adding a ComponentListener's componentMoved() to the frame,
but this will fire multiple times during the 'move'.

the trick will be to determine when the move has finished, i.e. returning to 'solid'.
maybe a Timer, repeats(false) each firing, to check if current x,y = old x,y (???)
 
Darryl Burke
Bartender
Posts: 5132
11
Java Netbeans IDE Opera
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Tim, please BeForthrightWhenCrossPostingToOtherSites
http://www.java-forums.org/awt-swing/68509-click-jframe-titlebar-sets-jframe-opaque.html
 
Michael Dunn
Ranch Hand
Posts: 4632
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Darryl, another time-waster added to my ignore list.
 
Tim Alvord
Greenhorn
Posts: 23
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Darryl, Michael...
Sorry about the Cross Posting. Didn't realize that it was frowned upon in the Java arena. I come from the .Net world where is is not only allowed but encouraged...


Tim
 
Rob Spoor
Sheriff
Pie
Posts: 20552
57
Chrome Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If you would have read that FAQ entry you would have seen that we don't mind cross posting, as long as you tell every site involved.
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic