34343

How to embed a windows program inside java component

Question:

I have done a little research online with no luck, and I cant seem to see a question on SO similar to this.

I wanted to know if its possible to place a windows program to fit inside a jFrame or jWindow. The particular example I had in mind was if I were to create a jFrame, can I spawn a windows program to open (i.e. cmd.exe) and embed that window within my jFrame somewhere. Hopefully the following image depicts what Im trying to acheive.

<img alt="enter image description here" class="b-lazy" data-src="https://i.stack.imgur.com/uWopn.jpg" data-original="https://i.stack.imgur.com/uWopn.jpg" src="https://etrip.eimg.top/images/2019/05/07/timg.gif" />

Answer1:

This has been asked before several times on this site, and always, as far as I can recall the answer is the same: while yes this is theoretically feasible, it is extraordinarily difficult to implement, especially since Java Swing uses light weight components that are not created by the OS, but created by the Swing itself. You would be better off using a language that allows you to get tighter with the operating system such as C# if Windows or C/C++ with Windows and most everything else.

So my final answer: this is not practical with Java Swing GUI's.

<hr />

<strong>Edit</strong><br /> Note that if all you want to do is to stream output from the command line, this can be done by displaying it in a JTextField or JEditPane or JTextPane. There is no need to embed an OS window into the GUI for this.

Recommend

  • What is the purpose of “String[] whereArgs” in “int delete (String table, String whereClause, String
  • Make a label both Italic and Bold style in Matplotlib with stix font
  • Use resources in unit tests with Swift Package Manager
  • Picasso only loading one image in a BaseAdapter
  • Accessing hidden field value in javascript
  • Vim configuration, setting up autocomplete, and columns
  • Porter Stemming of fried
  • Let apache handle 404 error when deemed appropriate by PHP?
  • Botframework - resize bot chat in width [duplicate]
  • Why are views not counted if you embed a youtube iframe dynamically using jquery?
  • How to get the click event on sIFR embedded tag in IE?
  • View Paypal shopping cart contents on my site
  • Timeout a query
  • VSCode change debug shell to bash on windows
  • Error processing multiple files
  • aapt.exe'' finished with non-zero exit value 1
  • During installation of Django, why do I keep getting ImportError: No module named django?
  • pillow imaging ImportError
  • Tamper-proof configuration files in .NET?
  • Code in Job's Script Block after Start-Process Does not Execute
  • How can I enlarge video fullscreen without the affected interface project in as3?
  • Python urlparse: small issue
  • Alert pop up with LWUIT
  • FileReader+canvas image loading problem
  • All Classes Conforming to Protocol Inherit Default Implementation
  • Disabling Alt-F4 on a Win Forms NotifyIcon
  • How to redirect a user to a different server and include HTTP basic authentication credentials?
  • Running a C# exe file
  • Can I make an Android app that runs a web view in Chrome 39?
  • Websockets service method fails during R startup
  • Jquery - Jquery Wysiwyg return html as a string
  • Arrays break string types in Julia
  • How to include full .NET prerequisite for Wix Burn installer
  • AngularJs get employee from factory
  • WPF Applying a trigger on binding failure
  • How to CLICK on IE download dialog box i.e.(Open, Save, Save As…)
  • Java static initializers and reflection
  • LevelDB C iterator
  • Linking SubReports Without LinkChild/LinkMaster
  • python draw pie shapes with colour filled