Article View: borland.public.jbuilder.java.swing
Article #816Re: Referencing a component from a string
From: Kevin Dean
Date: Mon, 19 Jul 2004 11:34
Date: Mon, 19 Jul 2004 11:34
26 lines
1882 bytes
1882 bytes
Assuming that the component is accessible to the class that wants to access it, you can find the component using the Java Reflection API: Field f = container.getClass().getField(componentName); Component c = (Container)f.get(container); -- Check out our latest white papers at http://www.datadevelopment.com/papers/index.html BladeNET Scores With Borland Enterprise Tools Team Development with JBuilder and Borland Enterprise Server Dolphin Data Development Ltd. http://www.datadevelopment.com/ "john" <john.butler@crowderconsult.co.uk> wrote in message news:40fb99d1$1@newsgroups.borland.com... > Is there a way to reference a component when all you have is a string with > the name of the component in it? The component has been created in the code. > A sequence is used to create unique names for the component so all i have is > a string with for the name. > >
Technical Details
Message-ID:
<40fbb200$1@newsgroups.borland.com>Path:
arc1-ca.pugleaf.net!g2news1.google.com!news1.google.com!news.glorb.com!border1.nntp.dca.giganews.com!border2.nntp.dca.giganews.com!nntp.giganews.com!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mailReferences:
<40fb99d1$1@newsgroups.borland.com>Show Full Headers
Complete Article Headers
X-Google-Thread: 111d45,62721dc3dc52e034 X-Google-Attributes: gid111d45,public X-Google-Language: ENGLISH,ASCII-7-bit From: "Kevin Dean" <NkOdSePaAnM@datadevelopment.com> Newsgroups: borland.public.jbuilder.java.swing References: <40fb99d1$1@newsgroups.borland.com> Subject: Re: Referencing a component from a string Date: Mon, 19 Jul 2004 07:34:59 -0400 Lines: 28 Organization: Dolphin Data Development Ltd. X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2800.1437 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1441 NNTP-Posting-Host: 24.57.150.243 Message-ID: <40fbb200$1@newsgroups.borland.com> X-Trace: newsgroups.borland.com 1090236928 24.57.150.243 (19 Jul 2004 04:35:28 -0700) Path: arc1-ca.pugleaf.net!g2news1.google.com!news1.google.com!news.glorb.com!border1.nntp.dca.giganews.com!border2.nntp.dca.giganews.com!nntp.giganews.com!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail