• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Paul Clapham
  • Ron McLeod
  • Tim Cooke
  • Junilu Lacar
Sheriffs:
  • Rob Spoor
  • Devaka Cooray
  • Jeanne Boyarsky
Saloon Keepers:
  • Jesse Silverman
  • Stephan van Hulst
  • Tim Moores
  • Carey Brown
  • Tim Holloway
Bartenders:
  • Jj Roberts
  • Al Hobbs
  • Piet Souris

JLabel changes and then goes back??

 
Ranch Hand
Posts: 142
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Ranch Hand
Posts: 148
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
You showed up just in time for the waffles! And this tiny ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
reply
    Bookmark Topic Watch Topic
  • New Topic