• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Adding an Executable to JFrame

 
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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


 
Marshal
Posts: 79151
377
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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



 
Bartender
Posts: 1561
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Ranch Hand
Posts: 15304
6
Mac OS X IntelliJ IDE Chrome
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
reply
    Bookmark Topic Watch Topic
  • New Topic