In short: there is no way.
If you hide a frame it does not alter any jComponents state. So becoming
visible again means it will show up as before.
There are these possibilites:
a) if your frame does not take long for build up simply generate a new one
each time (this is the quick - and not so elegant way)
b) write an init method that sets all items to a default value/selection and
overload setVisible(boolean) to call it at any time you use setVisible(true)
c) same as b) but with a generic state class that iterates over all components
at the time the frame is build , stores their initial states and can be used
in the init method
And by the way: often it is faster to reset the components' values than to
build the frame from scratch.
Regards,
Stefan
"Dr. Muhammad Masroor Ali" wrote:
> Hello All,
> I have a JFrame which contains a number of radio buttons along with
> other components. The frame is displayed using setVisible(true), and
> then after some radio buttons are selected by the click of a button, it
> is made invisible with setVisible(false). This frame is automatically
> displayed again after certain time has elapsed. But my problem is the
> frame appears with the previous (radio button) selections. Is there a
> quick way of initializing the frame rather than going through each item?
>
> --
> Dr. Muhammad Masroor Ali
> Associate Professor, Department of CSE
> BUET, Dhaka-1000, Bangladesh
>
> Consultant, n.:
> Someone who'd rather climb a tree and tell a lie than stand
> on the ground and tell the truth.
> _______________________________________________
> Advanced-swing mailing list
> [EMAIL PROTECTED]
> http://eos.dk/mailman/listinfo/advanced-swing
_______________________________________________
Advanced-swing mailing list
[EMAIL PROTECTED]
http://eos.dk/mailman/listinfo/advanced-swing