Article View: borland.public.jbuilder.java.swing
Article #10254Re: Radio Button Group
From: Christian Maul
Date: Wed, 20 Oct 1999 00:00
Date: Wed, 20 Oct 1999 00:00
102 lines
3617 bytes
3617 bytes
This is a multi-part message in MIME format.
--------------59B1CAD5DCEE9A72CD0F27E8
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Joe,
no idea what it is, however this is a copy from a program that runs with JB3
and SunVM 1.2.2
declaration
JRadioButton checkboxDB = new JRadioButton();
JRadioButton checkboxUs = new JRadioButton();
ButtonGroup checkboxUSDB = new ButtonGroup();
JPanel panelDBUS = new JPanel();
in init method ....
checkboxDB.setSelected(true);
checkboxDB.setText("from database");
checkboxDB.addActionListener(new
IrrigationTabset_checkboxDB_actionAdapter(this));
checkboxUs.setText("User entry");
checkboxUs.addActionListener(new
IrrigationTabset_checkboxUs_actionAdapter(this));
checkboxUSDB.add(checkboxDB);
checkboxUSDB.add(checkboxUs);
panelDBUS.setBorder(border1);
panelDBUS.setLayout(verticalFlowLayout1);
panelDBUS.add(checkboxUs, null);
panelDBUS.add(checkboxDB, null);
......
add the panel (in my case panelDBUS) to another container
the method that kicks in - in case the checkboxDB is selected
.................
void checkboxDB_actionPerformed(ActionEvent e) {
if (checkboxDB.isSelected()) {
if (checkboxSE.isSelected()) {
fieldEff.setEnabled(true); ..................ec. etc.
.............
another similar method for the other checkbox
2 inner class for the listener objects (JBuilder does that for you)
and you're done.
looks very similar to me (exept the container and calling the parameterless
constructor which shouldn't make a difference), and runs, hmm what is the
problem???
Cheers
Christian
Joe Reiss wrote:
> Hi
>
> 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
>
> I'm going according to ex. stuff I've seen (JFC swing tutorial)-Sun and
> other books. Seems like straightfoward thing to do.
>
> TIA,
> Joe
> (frustrated Delphi guy)
--------------59B1CAD5DCEE9A72CD0F27E8
Content-Type: text/x-vcard; charset=us-ascii;
name="Christian.Maul.vcf"
Content-Transfer-Encoding: 7bit
Content-Description: Card for Christian Maul
Content-Disposition: attachment;
filename="Christian.Maul.vcf"
begin:vcard
n:Maul;Christian
tel;fax:+61-3-5833 5337
tel;work:+61-3-5833 5226
x-mozilla-html:FALSE
org:ISIA;Stone- and Pomefruit Section
adr:;;Ferguson Rd;Tatura;Victoria;3616;Australia
version:2.1
email;internet:Christian.Maul@nre.vic.gov.au
title:Scientist
end:vcard
--------------59B1CAD5DCEE9A72CD0F27E8--
Technical Details
Message-ID:
<380D391A.A2461F74@nre.vic.gov.au>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: Christian Maul <Christian.Maul@nre.vic.gov.au> Subject: Re: Radio Button Group Date: 1999/10/20 Message-ID: <380D391A.A2461F74@nre.vic.gov.au> X-Deja-AN: 538276752 References: <3804C338.C3DCDD54@popd.ix.netcom.com> X-Accept-Language: en,de,es,it,pt,fr,nl,da,no,sv Content-Type: multipart/mixed; boundary="------------59B1CAD5DCEE9A72CD0F27E8" Organization: ISIA Mime-Version: 1.0 Newsgroups: borland.public.jbuilder.java.swing