• 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 all forums
this forum made possible by our volunteer staff, including ...
  • Campbell Ritchie
  • Liutauras Vilda
  • Jeanne Boyarsky
  • Devaka Cooray
  • Paul Clapham
  • Tim Cooke
  • Knute Snortum
  • Bear Bibeault
Saloon Keepers:
  • Ron McLeod
  • Tim Moores
  • Stephan van Hulst
  • Piet Souris
  • Ganesh Patekar
  • Frits Walraven
  • Carey Brown
  • Tim Holloway

JLabel not displaying

Ranch Hand
Posts: 331
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I created a custom modal dialog class that will pop-up, run some Runnable task, and then go away once the task is complete. It's a very basic window containing a single JLabel that displays some informational message to the user, like "Retrieving data...". Here is the code:

To use it, I am launching a new thread, something like this:

The problem is this: The first time I launch a new ModalDialog, it looks perfect - the window appears with the appropriate message. However, in subsequent uses, the JLabel does not appear so the user just sees a blank modal window. The only difference I can see is that the first launch occurs within the constuctor of my app whereas the subsequent launches originate through the event thread (e.g. user clicked a button). However, since in both cases, I run the ModalDialog in a new thread, it doesn't seem like that should matter.

I have tried many things such as calling repaint(), validate(), launching new threads, etc, etc.
Does anyone have any suggestions?
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!