Article View: borland.public.jbuilder.java.swing
Article #12433Array of JCheckBoxes
From: Vasudevan Srinivasan
Date: Tue, 29 Dec 1998 00:00
Date: Tue, 29 Dec 1998 00:00
19 lines
932 bytes
932 bytes
Hi,
I tried creating an array of checkboxes and add them to a panel. here is
the code:
...
JCheckBox chkBoxes[];
String names[] = {"A1","A2",...};
...
chkBoxes = new JCheckBox[10];
for (i=0;i<10;i++) {
chkBoxes[i].setText(names[i]);
panel.add(chkBoxes[i]);
}
And this gives me a null pointer exception at chkBoxes[i].setText(...);
I should be missing something, just dunno what ...
Thanks for any help.
Vasu
Technical Details
Message-ID:
<3689308F.68014E53@netrisk.com>Path:
arc1-ca.pugleaf.net!unknown!not-for-mailShow Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 111d45,67c16edf41741832,start X-Google-Attributes: gid111d45,public From: Vasudevan Srinivasan <vasudevan@netrisk.com> Subject: Array of JCheckBoxes Date: 1998/12/29 Message-ID: <3689308F.68014E53@netrisk.com> X-Deja-AN: 426858501 Content-Transfer-Encoding: 7bit Organization: Another Netscape Collabra Server User Content-Type: text/plain; charset=us-ascii Mime-Version: 1.0 Newsgroups: borland.public.jbuilder.java.swing