• Post Reply Bookmark Topic Watch Topic
  • New Topic

How do I set the opacity of a JLabel/JLabel's Image?  RSS feed

 
Dan Kao
Greenhorn
Posts: 18
Eclipse IDE Java Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'm trying to make a JLabel with an image fade in from transparent to fully visible.
Is this possible with the JLabel itself or would I have to change the Image?
If I'd have to change the Image's opacity how would I do this?

Thanks
 
Rob Camick
Ranch Hand
Posts: 2787
12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Here is some old code I found on the web that shows one way to do this:


Use the slider to change the opacity of the foreground image.
 
Dan Kao
Greenhorn
Posts: 18
Eclipse IDE Java Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks, works well.
Sorry to bother, but how would I make a loop to increase the value of alpha from 0 to 1 manually without a slider?
 
Rob Camick
Ranch Hand
Posts: 2787
12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Use a Swing Timer.
 
Dan Kao
Greenhorn
Posts: 18
Eclipse IDE Java Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks, did that
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!