Fading Text
Is there a way i can make text/Labels fade
Almost certainly. [url=http://www.amazon.co.uk/Swing-Hacks-Joshua-Marinacci/dp/0596009070/ref=pd_bbs_sr_1/202-1573928-2308622?ie=UTF8&s=books&qid=1178121946&sr=8-1]This book[/url] almost certainly has what you're after in it, and more besides. Well worth a look if you want to play around with Swing
Use a javax.swing.Timer to drive code that gradually changes the component's Foreground color.
> Use a javax.swing.Timer to drive code that gradually> changes the component's Foreground color.how so?
> > Use a javax.swing.Timer to drive code that gradually> > changes the component's Foreground color.> > how so? http://java.sun.com/docs/books/tutorial/uiswing/misc/timer.html
can ypu please give me a quick example, so i can try to program it in.
You've read that tutorial section already?
yeah, but i dont know what "!worker.isDone())" plus all the width stuffMessage was edited by: ichbinsterben
plus im using tex or labelst not imagesMessage was edited by: ichbinsterben
The thing about reading a tutorial or textbook is that it's supposed to teachyou something more general or point you in the right direction. Youshouldn't expect to find the exact code you need to paste into your code.
> The thing about reading a tutorial or textbook is
> that it's supposed to teach
> you something more general or point you in the right
> direction. You
> shouldn't expect to find the exact code you need to
> paste into your code.
I DON'T PLAN ON PASTING THE CODE IN!!!!!!!
I just need to see an example of how its written with labels not IMAGES
Message was edited by:
ichbinsterben
Message was edited by:
ichbinsterben
How about an ActionListener that looks like this:
public void actionPerformed(ActionEvent e) {
Color color = calculate next color in fade
yourComponent.setForeground(color);
if (fade is complete)
timer.stop();
}
I based this on what I read in the tutorial.
can i use Story = new JLabel(" ");to have it clear in the processyou to show for half a second then disappear, then start with a new text?Message was edited by: ichbinsterben
Usually the best way to clear is to calltheLabel.setText("");on an existing label in the gui. If you create a *new* JLabel, you wouldhave to remove the old label and add the new label and then relayout itscontainer. Not worth it.