Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to call com.foo.myprogram by pressing a buttom

Status
Not open for further replies.

cadbilbao

Programmer
Apr 9, 2001
233
ES
Hello.

I performed a program called 'myprogram' and, since now, I executed it by calling from MS-DOS:
java com.foo.myprogram param1 param2 param3

But I created a Swing program, and I would like to call it by pressing a buttom:

button.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
<<< I do not know >>>
}
});

any help is welcome.

Regards and thank you.
 
Your swing program is just another class file. Add a constructor to it that takes a String array for your parameters and does whatever the main() method does, and just create an instance of the class in your action method.

MySwingApp swingapp = new MySwingApp( args );
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top