aspose file tools*
The moose likes Swing / AWT / SWT and the fly likes calling another swing application to run when a button is click from my swing application Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "calling another swing application to run when a button is click from my swing application" Watch "calling another swing application to run when a button is click from my swing application" New topic
Author

calling another swing application to run when a button is click from my swing application

joseph okon
Ranch Hand

Joined: Dec 07, 2004
Posts: 63
this is my code
the one that will call the other application when the Okbtn is clicked. this is the second code

all i want is to get the logic on how to call another application main method to run and be made visible.
i will really appreciate ,
thanks
joseph
Peter Taucher
Ranch Hand

Joined: Nov 18, 2006
Posts: 174
You don't want tu run the main method of TransferClass but instead to instantiate the TransferFrame and make it visible. Just insert your code from TransferClass#main to MyFramePanel#actionPerformed ... for a start.


Censorship is the younger of two shameful sisters, the older one bears the name inquisition.
-- Johann Nepomuk Nestroy
Peter Taucher
Ranch Hand

Joined: Nov 18, 2006
Posts: 174
I'm just curious. Is this topic still of interest?
pete stein
Bartender

Joined: Feb 23, 2007
Posts: 1561
Peter Taucher wrote:I'm just curious. Is this topic still of interest?


Maybe not to the original poster, but it will be to future generations of Swing programmers.
joseph okon
Ranch Hand

Joined: Dec 07, 2004
Posts: 63
am very much interested in the post i made only that am not always online thanks to some factors.

joseph okon
Ranch Hand

Joined: Dec 07, 2004
Posts: 63
I have gotten it right. i had to put all the TransferFramePanel code into TransferClass Constructor and extends JFrame, then initialize TransferClass from MyClass action.
I want to exit MyClass window after TransferClass window is visible?
I use System.exit(1); but the whole Application was closed, that is MyClass and TransferClass window was closed.
what code can i use to close only MyClass window? am i little bit lost in the bush!!!
Peter Taucher
Ranch Hand

Joined: Nov 18, 2006
Posts: 174
http://java.sun.com/docs/books/tutorial/uiswing/components/frame.html
http://java.sun.com/javase/6/docs/api/java/awt/Window.html#setVisible(boolean)
joseph okon
Ranch Hand

Joined: Dec 07, 2004
Posts: 63
this is my action code

it is complaining
this is the error
pete stein
Bartender

Joined: Feb 23, 2007
Posts: 1561
joseph okon wrote:
it is complaining
this is the error


As well it should. You're calling dispose as if it were a static method of MyClass and per your code above it isn't. Perhaps you wish to get the reference to the JFrame and call dispose on it.
joseph okon
Ranch Hand

Joined: Dec 07, 2004
Posts: 63
i have gotten it by using this code

after making the TransferClass visble i use the SwingUtilities to get the ancestor window before calling the dispose() method
thanks to you all
 
Don't get me started about those stupid light bulbs.
 
subject: calling another swing application to run when a button is click from my swing application