Article View: borland.public.jbuilder.java.language
Article #16764Re: using a loop to create UI components
From: Vasudevan Srinivasan
Date: Mon, 18 Jan 1999 00:00
Date: Mon, 18 Jan 1999 00:00
26 lines
1425 bytes
1425 bytes
"Daniel R. J. Lind" wrote:
> Hi,
>
> I want to use a loop to add panels to a JTabbedPane component. I can get it
> working, but my trouble is with the names of the new components. How do I
> create a new instance of a component with a new name each time using a loop.
> I could just append an integer to its name such tab1, tab2 etc, but I don't
> know how to set the name based a string. If someone could reply with an
> example code-block I would thank the gods for thee!
>
> Cheers,
>
> Daniel
May be this could be of any help:
//code starts
String tabNames[] = {"Tab1", "Tab2",...};
for (int i=0; i<tabNames.length(); i++) {
tabPane.addTab(tabNames[i]);
}
//code ends
personal: btw, whats the score at christchurch now? ;-)
Vasu
Technical Details
Message-ID:
<36A3D8A4.7C2D6BD7@worldnet.att.net>Path:
arc1-ca.pugleaf.net!unknown!not-for-mailReferences:
<780c5j$a819@forums.borland.com>Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: f74b3,8b232ad1531d97b8,start X-Google-Attributes: gidf74b3,public From: Vasudevan Srinivasan <vasya10@worldnet.att.net> Subject: Re: using a loop to create UI components Date: 1999/01/18 Message-ID: <36A3D8A4.7C2D6BD7@worldnet.att.net> X-Deja-AN: 434225279 Content-Transfer-Encoding: 7bit References: <780c5j$a819@forums.borland.com> To: daniel@synopsys.co.nz X-Accept-Language: en Content-Type: text/plain; charset=us-ascii Organization: Another Netscape Collabra Server User Mime-Version: 1.0 Reply-To: vasya10@worldnet.att.net Newsgroups: borland.public.jbuilder.java.language