Re: Calling method question.
- From: Ian Shef <invalid@xxxxxxxxxxxxx>
- Date: Mon, 25 Apr 2005 19:32:43 GMT
"YoungSherlok" <zxxhfxfxjkrf@xxxxxxxxxxxx> wrote in news:TQx9e.28558
$il.27549@xxxxxxxxxxxxxxxxxxxx:
> I have a GUI list which contains a list of string references to java test
> scripts in a seperate package. Also a button to extract the selected
script
> and run it. However, I cannot figure out how to make it run.
>
> testHarness.testScripts.TestA.runTest(); //works OK
>
> but
>
> testHarness.testScripts.current_scripts[i].runTest(); //Does
not
> work
>
> NB: public static String[] current_scripts = new String[40];
>
> Can some kind person put me out of my misery and tell me how to do it.
>
> TIA.
>
>
>
See documentation for class lava.lang.Class and for package
java.lang.reflect. These are sometimes called the Java Reflection API.
They provide the ability to create instances of objects identified by a
String, and to call methods identified by a String (and much more).
--
Ian Shef 805/F6 * These are my personal opinions
Raytheon Company * and not those of my employer.
PO Box 11337 *
Tucson, AZ 85734-1337 *
.
- References:
- Calling method question.
- From: YoungSherlok
- Calling method question.
- Prev by Date: Re: How to add rows of text to JTextArea
- Next by Date: Re: Styled Document and icons
- Previous by thread: Re: Calling method question.
- Next by thread: Copy and Paste Unformatted Text
- Index(es):