Two Laptop Bag*
The moose likes Swing / AWT / SWT and the fly likes different colors in each letter of a string Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "different colors in each letter of a string" Watch "different colors in each letter of a string" New topic
Author

different colors in each letter of a string

sushant prabhu
Ranch Hand

Joined: Mar 22, 2001
Posts: 66
I am creating a ticker in an applet where i am using the drawString method of the Graphics class
. what i want is each letter of the string which will be painted by the drawString method on the applet should be in a different color.
say if my String is JAVA , i want J in a different color, A in a different color, V in a different color & A in a different color


Sushant Prabhu<br />SCJP2<br />SCWCD<br />OCA9i
Nathan Pruett
Bartender

Joined: Oct 18, 2000
Posts: 4121

Here's a short example of how you could do that...



-Nate


-Nate
Write once, run anywhere, because there's nowhere to hide! - /. A.C.
 
Don't get me started about those stupid light bulbs.
 
subject: different colors in each letter of a string
 
Similar Threads
JAVA architecture
drawString()
Painting on a Panel !
Query regarding Applet Printing.
JAVA architecture