aspose file tools*
The moose likes Swing / AWT / SWT and the fly likes JDialog components not refreshing Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "JDialog components not refreshing" Watch "JDialog components not refreshing" New topic
Author

JDialog components not refreshing

bob mccloud
Greenhorn

Joined: May 12, 2005
Posts: 2
Hello all.

I have searched for an answer for the following problem and have found none.

Basically I have created a setting dialog by extending JDialog. It has some radio buttons, text fields, etc. In addition to save and cancel buttons, I also have a reset button (to display defaults).

When I open the dialog and press the defaults button, the fields are updated. I then press cancel and reopen the dialog expecting to see the original values. However, I see the default values on the GUI, but if I examine the values of the fields themselves they are correct.

What am I missing?

Thanks in advance,

SWING Newbie
Stuart Gray
Ranch Hand

Joined: Apr 21, 2005
Posts: 410
Sounds like you should call your update (reset) code immediately before first displaying the dialog. Though without code to examine this is just a guess.
Craig Wood
Ranch Hand

Joined: Jan 14, 2004
Posts: 1535
bob mccloud
Greenhorn

Joined: May 12, 2005
Posts: 2
Thanks for the example (Stuart) and hint (Craig).

A buddy of mine pointed out that my function to create the dialog components was in the wrong place (actionPerformed versus constructor). Thus, I was generating new compnents each time.
 
Don't get me started about those stupid light bulbs.
 
subject: JDialog components not refreshing
 
Similar Threads
How to idientify that the contents of JDialog window are changed
JDialog trigger action opening JFrame closing problem
JTextField listener to enable button action
JDialog - akward problem
I have question about JFilechooser?