Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

load a class

 
Sammer Meer
Greenhorn
Posts: 19
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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?
 
Ali Gohar
Ranch Hand
Posts: 572
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 19
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 11
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
USE
Class.forName(path to your class)
It will load ur class.
Note Class is a Class itself and forName is static method.
 
Dirk Schreckmann
Sheriff
Posts: 7023
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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...
 
somkiat puisungnoen
Ranch Hand
Posts: 1312
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
you must have main class for control UI and UI module class is base class for create UI in each panel



Class extends UIModule
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic