| Author |
load a class
|
Sammer Meer
Greenhorn
Joined: Mar 24, 2004
Posts: 19
|
|
|
I have a program with a combo box, when i choose an item from the combo my program must go to a certain class and invoke a method in it , how can i do that?..how can i invoke this method in that certain class?
|
Ai no corrida..That's where I am<br />You send me there<br />Your dream is my command...
|
 |
Ali Gohar
Ranch Hand
Joined: Mar 18, 2004
Posts: 572
|
|
Not got the problem. please explain briefly. what type of application you are creating? is it web applicatoin with jsp or servlet? what type of method you want to call. You can call any method just by creating the object of that class.
|
 |
Sammer Meer
Greenhorn
Joined: Mar 24, 2004
Posts: 19
|
|
|
No, it's an application that deals with Barcodes.. I have to make for each standard a jar file that contains the classes necessary for encoding/decoding related to that standrd.An obligatory class (that must exist in every valid jar file) is a class derived JPanel.. I want to load this class from a certain jar file when the user chooses a standard (that's related to that jar file) from a ComboBox, and then I want to make an instance of that class (which extends JPanel) and add this panel to my frame..
|
 |
Kush Kush
Greenhorn
Joined: Apr 27, 2004
Posts: 11
|
|
USE Class.forName(path to your class) It will load ur class. Note Class is a Class itself and forName is static method.
|
Smile with JAVA
|
 |
Dirk Schreckmann
Sheriff
Joined: Dec 10, 2001
Posts: 7023
|
|
Sammer, I'm guessing a little that what you're trying to figure out is mostly GUI-related - eg. handling events, displaying panels. As such, I'm moving this to the Swing / JFC / AWT forum...
|
[How To Ask Good Questions] [JavaRanch FAQ Wiki] [JavaRanch Radio]
|
 |
somkiat puisungnoen
Ranch Hand
Joined: Jul 04, 2003
Posts: 1312
|
|
you must have main class for control UI and UI module class is base class for create UI in each panel Class extends UIModule
|
SCJA,SCJP,SCWCD,SCBCD,SCEA I
Java Developer, Thailand
|
 |
 |
|
|
subject: load a class
|
|
|