Reputation: 161
I am using the Graphics to draw a string to the monitor and i want that a specific variable wiil be in a diffrent color.
e.g: "You hit by a meteor " + number + " times. I want the "number" will draw in different color from the string. Maybe i can work with HTML?
Upvotes: 2
Views: 66
Reputation: 1326
With Graphics you have a drawString(String str, int x, int y) for drawing strings. Since its using the graphics context's current font and color, all you can do is something like this:
g.setColor();
g.drawString();
g.setColor();
g.drawString();
... and so on. In your case drawing it in 3 pieces.
Upvotes: 1