This week's book giveaway is in the Agile and Other Processes forum.
We're giving away four copies of The Little Book of Impediments (e-book only) and have Tom Perry on-line!
See this thread for details.
Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Fading in/out an image - please help...

 
Al Murphy Al Murphy
Greenhorn
Posts: 16
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

Wondering can you help me please. I've written a small applet that uses a thread to display small pictures one after another. The images are small and stay on screen for about 3 seconds. It then abruptly disppears to be replaced by the next image.
It's pretty simple stuff really. Nothing terribly sophisticated.


For example to load up an image:

Image img = getImage(getcodeBase(), "1.jpg");
etc

The thread stuff is pretty straighforward too:

public void run()
{
Thread myThread = Thread.currentThread();
while(imageThread = mythread)
{
repaint();
image += image;// increment image
}

} // end run()


The problem is though I want to *fade* each image in and out to be replace by the next image.
However I don't know how to do this exactly. Can anyone out there help me please? Any suggestions/comments/code-samples would be most appreciative.

Cheers,
Al.
 
Craig Wood
Ranch Hand
Posts: 1535
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
java.awt.AlphaComposite with java.awt.Graphics2D
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic