🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: borland.public.jbuilder.java.language
Article #14437

Re: How to call a component by name?

#14437
From: nlaan
Date: Wed, 08 Sep 1999 00:00
25 lines
1131 bytes
What are the advantages of using:
MyClass myClass = Class.forName("MyClass").newInstance();

as opposed to:
MClass myClass = new MyClass();

thanks;
nlaan


Johan Forsberg wrote in message <7r525b$8nj7@forums.borland.com>...
>
>Bombi <abonetti@yahoo.com> skrev i
>diskussionsgruppsmeddelandet:7r3sre$st7@forums.borland.com...
>> Hi there,
>>
>> I've an application with a JPanel. How can I use my JPanel calling it by
>> name ?
>>
>> Something like    JPanel1 jPanel = createComponent("JPanel1")  instead of
>> new JPanel1() ?
>
>JPanel1 jPanel=Class.forName("my.package.JPanel1").newInstance();
>
>
Technical Details
Message-ID: <7r6i1e$m6p1@forums.borland.com>
Path: arc1-ca.pugleaf.net!unknown!not-for-mail
References: <7r3sre$st7@forums.borland.com> <7r525b$8nj7@forums.borland.com>

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: f74b3,43efad4802ffae21
X-Google-Attributes: gidf74b3,public
From: <nlaan>
Subject: Re: How to call a component by name?
Date: 1999/09/08
Message-ID: <7r6i1e$m6p1@forums.borland.com>
X-Deja-AN: 522664303
References: <7r3sre$st7@forums.borland.com> <7r525b$8nj7@forums.borland.com>
Organization: Another Netscape Collabra Server User
X-MimeOLE: Produced By Microsoft MimeOLE V4.72.3110.3
Newsgroups: borland.public.jbuilder.java.language