• Post Reply Bookmark Topic Watch Topic
  • New Topic

Adding an Executable to JFrame  RSS feed

 
Sagar Chin
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi ,
I am trying to call an EXE file from a Button Action using getRunTime.exec("abc.exe");
It opens the exe file fine, but i want this to open inside JFrame or JDialog or any Swing Component.
Could any one please let me know how to do this.

Thanks in Advance


 
Campbell Ritchie
Sheriff
Posts: 55351
157
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Welcome to JavaRanch

You could try diverting the output and error streams from the Process and displaying that output on a JTextField or even a JLabel.

Don't know whether that will work, and other people will have good ideas too.
 
Sagar Chin
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks for your quick reply.

Actually it's a calculator in the .exe file format.
I should be able to open that calculator in any of JDialog,JFrame etc so that i can use the calculator in my application.
My Application runs in Full screen mode and this calculator dialog should pop up in a Dialog when the application is still in full screen mode.

Please let me know if there is any solution

Thanks



 
pete stein
Bartender
Posts: 1561
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Chinnari Sagar wrote:
Actually it's a calculator in the .exe file format.
I should be able to open that calculator in any of JDialog,JFrame etc so that i can use the calculator in my application.
My Application runs in Full screen mode and this calculator dialog should pop up in a Dialog when the application is still in full screen mode.

I'm no expert in this, not by any means, but it sounds as if you may be asking Java to do something it wasn't built to do. Perhaps this could be done using a C program then meshed with Java via JNI, but it wouldn't be easy. I'd be interested to hear if one of the experts has any other ideas. Best of luck.
 
Gregg Bolinger
Ranch Hand
Posts: 15304
6
Chrome IntelliJ IDE Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Cynical answer. "Teacher told me to create a calculator in Swing. Windows already has one so I'll avoid the work by putting it in my JFrame".

Short answer to your question is you can't. I'm sure there is some long winded way, as Pete suggested, to do this, but this is beyond the basic design and premise of Java and Swing. If you want a calculator in your swing app, find a swing calculator or write one yourself.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!