Article View: borland.public.jbuilder.java.swing
Article #10251Re: Radio Button Group
From: Paul Furbacher [TeamB]
Date: Tue, 19 Oct 1999 00:00
Date: Tue, 19 Oct 1999 00:00
39 lines
1778 bytes
1778 bytes
Joe Reiss wrote:
> I'm trying to set up a radiobutton group with the following code with no
> luck.
>
> 1 JRadioButton jrbDisplayDomainNames = new JRadioButton("Domain
> Names",true);
> 2 JRadioButton jrbDomainDescriptions = new JRadioButton("Domain &
> description",false);
> 3 ButtonGroup group = new ButtonGroup();
> 4 group.add(jrbDisplayDomainNames);
> 5 group.add(jrbDomainDescriptions);
>
> When I compile Iget the following messages:
>
> 4 invalid method declaration
> 4 illegal start of type
> 5 invalid method declaration
> 5 illegal start of type
Offhand, I can't see what you are doing incorrectly. Comment out
the above code and see if you get any error messages. You might
have an error above this block of code.
After that, try the following which uses shorter names and text:
JRadioButton rb1 = new JRadioButton("a", true);
JRadioButton rb2 = new JRadioButton("b", false);
JRadioButton rb3 = new JRadioButton("c", false);
ButtonGroup group = new ButtonGroup();
group.add(rb1);
group.add(rb2);
group.add(rb3);
I just prototyped this and it works just fine.
Paul Furbacher (TeamB)
Technical Details
Message-ID:
<380CF0CC.C2B98F0D@bilbo.bio.purdue.edu>Path:
arc1-ca.pugleaf.net!unknown!not-for-mailReferences:
<3804C338.C3DCDD54@popd.ix.netcom.com>Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 111d45,e9fe56bb5f5efeec X-Google-Attributes: gid111d45,public From: "Paul Furbacher [TeamB]" <pf@bilbo.bio.purdue.edu> Subject: Re: Radio Button Group Date: 1999/10/19 Message-ID: <380CF0CC.C2B98F0D@bilbo.bio.purdue.edu> X-Deja-AN: 538191397 Content-Transfer-Encoding: 7bit References: <3804C338.C3DCDD54@popd.ix.netcom.com> Content-Type: text/plain; charset=us-ascii Organization: Reverse Alchemy, Inc. Mime-Version: 1.0 Reply-To: pf@bilbo.bio.purdue.edu Newsgroups: borland.public.jbuilder.java.swing