This week's book giveaways are in the Refactoring and Agile forums.
We're giving away four copies each of Re-engineering Legacy Software and Docker in Action and have the authors on-line!
See this thread and this one for details.
Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Cloud/Virtualization forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Variable transparency cover for Swing layout.

 
Chris Kimball
Ranch Hand
Posts: 35
Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'd like to put a jpg graphic of variable transparency over an operable Swing layout.

The Swing tutorials demonstrate graphics with variable transparency within the Graphic, however, the Swing components are outside the graphic. Another example on the web positions an opaque Swing panel over the top of a graphic. But what I'd like is to have the jpg cover the graphic completely at one end of the slider, while at the other end, only the Swing component are visible.

Suggestions would be appreciated.

Chris
 
m Korbel
Ranch Hand
Posts: 174
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
there aer three ways

1. JLayer (Java7) based on JXLayer(Java6)

2. GlassPane (only for lightweight Swing JComponents otherwise is Glasspane behind heavyweight JComponent)

3. JViewport (notice with JViewport.BLIT_SCROLL_MODE, JViewport.BACKINGSTORE_SCROLL_MODE, JViewport.SIMPLE_SCROLL_MODE to avoiding flickering)
 
Michael Dunn
Ranch Hand
Posts: 4632
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
> But what I'd like is to have the jpg cover the graphic completely at one end of the slider, while at the other end, only the Swing component are visible.

perhaps an OverlayLayout might work
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic