[i]repaint()[/i] is perfectly fine. ;)  What you need to do is supply it a 
clipping rectangle.  In all likelihood, the reason for your previous box not 
disappearing is because it is never repainted.  It's easy to make this 
mistake--to only draw the new highlight and not wipe the previous--so you must 
make a habit of redrawing both the previous position as the current one.

[code]
public void setHighlight(int index) {
  if (index != this.index) {
    Rectangle prev = getGraphBounds(this.index);
    Rectangle next = getGraphBounds(index);
    this.index = index;
    repaint(prev);
    repaint(next);
    // or repaint(prev.union(next));
  }
}
[/code]

That should suffice, I believe.  Your code may vary, but this is a way to deal 
with it.
[Message sent by forum member 'tarbo' (tarbo)]

http://forums.java.net/jive/thread.jspa?messageID=207808

===========================================================================
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff JAVA2D-INTEREST".  For general help, send email to
[EMAIL PROTECTED] and include in the body of the message "help".

Reply via email to