• Post Reply Bookmark Topic Watch Topic
  • New Topic

JLabel changes and then goes back??  RSS feed

 
Brian Snyder
Ranch Hand
Posts: 142
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
When I resize a window or move it back on screen from being
off screen, why does my 'relabeled' JLabel show the old value?
I have a JLabel with a current text label.
>I am able to place this onto a JPanel which then is placed in a JFrame. Somewhere in my program, I change the JLabel's text. When I redraw the JPanel containing the JLabel, the change appears with no problem.
The problem occurs once I minimize and/or restore/maximize the window, move the window off screen, or have another window go over it. Once one of these things occurs, the OLD Label comes back.

Many thanks in advance for your assistance. I've tried invalidate followed by validate, but the same thing keeps happening. It changes, but once the window is refreshed, the old value comes back.
 
Vinod Venugopal
Ranch Hand
Posts: 148
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Could u pls post the code also?..would like to know the Labels state.
 
Brian Snyder
Ranch Hand
Posts: 142
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Vinod,
I was able to fix the problem. I had a panel ontop of a panel. The panel underneath was not being 'validate()-d'. Only the one on top was. Now that I used validate() on both panels, I am .
Thanks for you help.
Brian
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!