External Program inside a JPanel
Hello, I'm trying to run an existing executable from my Java program, say "C:\Windows\System32\calc.exe" I know that I can start the process via the command:
Process p = Runtime.getRuntime().exec("C:\\Windows\\System32\\ calc.exe");
The catch is that I want it to be contained inside my JPanel with no title bar or frame, just the program. If that's not possible could I somehow strip the title bar and frame and move the location of the program such that it overlaps with my JPanel (ontop of)?
Thanks!
Re: External Program inside a JPanel
If what you desire is to display a non-Java GUI inside of a Swing application, I'm going to suggest that you don't do this as it is extremely difficult to do, and I've never seen a satisfactory solution for this.
As for stripping the title bar and moving the GUI, yes, that could be done but would require JNI or JNA to do.
Re: External Program inside a JPanel
Well I know that wmctrl in linux can be used to move and resize the window, we're currently using this to place the new process ontop of the JPanel such that it seems as if it is running inside the Java application. I take it there's no windows equivalent?
Re: External Program inside a JPanel
Quote:
Originally Posted by
peress
Well I know that wmctrl in linux can be used to move and resize the window, we're currently using this to place the new process ontop of the JPanel such that it seems as if it is running inside the Java application. I take it there's no windows equivalent?
I'm not familiar with Linux, but I do know that moving and resizing a Window in Windows is fairly easy with JNA calls to the Windows user32.dll library. I've never tried removing decorations/title bar, but I imagine that this is also quite do-able with JNA and a brief inspection of the information held on the MSDN site.
Re: External Program inside a JPanel
Thanks! I'll look into that.
Re: External Program inside a JPanel
You're welcome and best of luck!