Fading Text

Is there a way i can make text/Labels fade
[49 byte] By [ichbinsterbena] at [2007-11-27 3:06:31]
# 1

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

georgemca at 2007-7-12 3:52:58 > top of Java-index,Java Essentials,New To Java...
# 2
Use a javax.swing.Timer to drive code that gradually changes the component's Foreground color.
DrLaszloJamfa at 2007-7-12 3:52:58 > top of Java-index,Java Essentials,New To Java...
# 3
> Use a javax.swing.Timer to drive code that gradually> changes the component's Foreground color.how so?
ichbinsterbena at 2007-7-12 3:52:58 > top of Java-index,Java Essentials,New To Java...
# 4
> > 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
DrLaszloJamfa at 2007-7-12 3:52:58 > top of Java-index,Java Essentials,New To Java...
# 5
can ypu please give me a quick example, so i can try to program it in.
ichbinsterbena at 2007-7-12 3:52:58 > top of Java-index,Java Essentials,New To Java...
# 6
You've read that tutorial section already?
DrLaszloJamfa at 2007-7-12 3:52:58 > top of Java-index,Java Essentials,New To Java...
# 7
yeah, but i dont know what "!worker.isDone())" plus all the width stuffMessage was edited by: ichbinsterben
ichbinsterbena at 2007-7-12 3:52:58 > top of Java-index,Java Essentials,New To Java...
# 8
plus im using tex or labelst not imagesMessage was edited by: ichbinsterben
ichbinsterbena at 2007-7-12 3:52:58 > top of Java-index,Java Essentials,New To Java...
# 9
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.
DrLaszloJamfa at 2007-7-12 3:52:58 > top of Java-index,Java Essentials,New To Java...
# 10

> 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

ichbinsterbena at 2007-7-12 3:52:58 > top of Java-index,Java Essentials,New To Java...
# 11

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.

DrLaszloJamfa at 2007-7-12 3:52:58 > top of Java-index,Java Essentials,New To Java...
# 12
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
ichbinsterbena at 2007-7-12 3:52:58 > top of Java-index,Java Essentials,New To Java...
# 13
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.
DrLaszloJamfa at 2007-7-12 3:52:58 > top of Java-index,Java Essentials,New To Java...