This week's book giveaway is in the OO, Patterns, UML and Refactoring forum.
We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma on-line!
See this thread for details.
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’ve looked at a lot of different solutions, and in my humble opinion Aspose is the way to go. Here’s the link:
subject: JLabel icon redrawing problem
It's not a secret anymore!