This week's book giveaway is in the Kotlin forum.
We're giving away four copies of Kotlin in Action and have Dmitry Jemerov & Svetlana Isakova on-line!
See this thread for details.
Win a copy of Kotlin in Action this week in the Kotlin forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

[Swing] Make (only) JFrame Background transparent & Component draggable  RSS feed

 
Christian Volkmann
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hey!

I am currently working on an overlay and testing every function out first.

The overlay should be completely translucent and only the elements, i.e. Components, should be displayed. Also, I would like to add a feature that makes dragging Panels possible.

My problem now is: I have drawn the rectangle onto the transparent background. Any time I drag it to another position, the rendering fails and the old projection does not get cleared. Also, the whole frame flashes when I start to drag. I think I might need to repaint it in a separate thread while the mouse button is held down, right?

I have tried many things until now, but none of them seemed to work to resolve the rendering error.

Here is my code. Thanks for the help in advance.



 
Rob Camick
Ranch Hand
Posts: 2800
15
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The code didn't compile because the Starter class was not included.

When I deleted the code referencing the Starter class it worked fine. I'm using JDK7_19 on Windows 7.

In case you are interested you can use the Component Mover classes to easily move any component.
 
Consider Paul's rocket mass heater.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!