Click to See Complete Forum and Search --> : String color


ehanna
July 31st, 2000, 03:05 PM
Hi every body
I am doing an applet that it will draw a string letter by letter. I want to be able to change the sting color when the mouse enter I do that
public boolean mouseEnter(Event e, int x, int y)
{
setForeground(Color.red);
repaint();
return true;
}
But in internet explorer it apply the color for the new string and not the one that has been already drawn. for Netscape id does not change at all.
Thank you

kib63613
July 31st, 2000, 06:25 PM
You may have a state flag set in the paint() method. If the the mouseEntered() event is fired, your code
set the state flag to true to indicate that when paint() is doing, the it will trigger some action about this
state. In this case, you may use g.setColor() to set the foreground string color. As my experience, the
setForeground seem not to work when you use drawString() to draw the string. One way you can use
is g.setColor() and then g.drawString().
good luck,
Alfred Wu