Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Cloud/Virtualization forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

different colors in each letter of a string

 
sushant prabhu
Ranch Hand
Posts: 66
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
Nathan Pruett
Bartender
Posts: 4121
IntelliJ IDE Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Here's a short example of how you could do that...



-Nate
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic