File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Swing / AWT / SWT and the fly likes JLabel icon redrawing problem Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "JLabel icon redrawing problem" Watch "JLabel icon redrawing problem" New topic

JLabel icon redrawing problem

D R Wilkinson
Ranch Hand

Joined: Oct 29, 2004
Posts: 51
Hello :-)

I am having trouble getting my MapHex (extends JLabel) to redraw itself properly. At the moment, each map hex only redraws as red when the tool text tip object moves off the hex that should have changed colour when the cursor entered or exited the map hex.

The map hexes are displayed within MapPanel (extends JPanel).

Craig Wood
Ranch Hand

Joined: Jan 14, 2004
Posts: 1535
Call repaint to show the new state:

Also, you might consider overriding paintComponent in MapHex instead of paint.
D R Wilkinson
Ranch Hand

Joined: Oct 29, 2004
Posts: 51
Thank you very much

I agree. Here's the link:
subject: JLabel icon redrawing problem
It's not a secret anymore!