This is all fine in the general case but in the case 
of the specific question asked there is a quick answer.
To uninitialise a group of radio buttons you add an
extra radio button to the group but do not make it
visible.  At initialisation set this button to selected
thereby deselecting all the visible ones.

Regards

Dave Wathen
Goldman Sachs Asset Management
3rd Floor, Procession House
55 Ludgate Hill
London EC4M 7JN
+44 (0)20-7774-2998

It is not necessary to understand things in order to argue about them.
(Caron de Beaumarchais)


-----Original Message-----
From: Stefan Dingfelder [mailto:[EMAIL PROTECTED]]
Sent: Saturday, March 10, 2001 2:58 PM
To: Dr. Muhammad Masroor Ali
Cc: [EMAIL PROTECTED]
Subject: Re: Initializing components of a Jframe


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
_______________________________________________
Advanced-swing mailing list
[EMAIL PROTECTED]
http://eos.dk/mailman/listinfo/advanced-swing

Reply via email to