Results 1 to 6 of 6
  1. #1
    peress is offline Member
    Join Date
    Aug 2012
    Posts
    3
    Rep Power
    0

    Default 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!

  2. #2
    Fubarable's Avatar
    Fubarable is offline Moderator
    Join Date
    Jun 2008
    Posts
    19,315
    Blog Entries
    1
    Rep Power
    26

    Default 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.

  3. #3
    peress is offline Member
    Join Date
    Aug 2012
    Posts
    3
    Rep Power
    0

    Default 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?

  4. #4
    Fubarable's Avatar
    Fubarable is offline Moderator
    Join Date
    Jun 2008
    Posts
    19,315
    Blog Entries
    1
    Rep Power
    26

    Default Re: External Program inside a JPanel

    Quote Originally Posted by peress View Post
    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.

  5. #5
    peress is offline Member
    Join Date
    Aug 2012
    Posts
    3
    Rep Power
    0

    Default Re: External Program inside a JPanel

    Thanks! I'll look into that.

  6. #6
    Fubarable's Avatar
    Fubarable is offline Moderator
    Join Date
    Jun 2008
    Posts
    19,315
    Blog Entries
    1
    Rep Power
    26

Similar Threads

  1. Replies: 30
    Last Post: 02-02-2012, 11:45 AM
  2. how to show jpanel from external jar?
    By skadron_alfa in forum New To Java
    Replies: 5
    Last Post: 01-15-2012, 07:27 AM
  3. how to open class(jpanel) from external jar?
    By skadron_alfa in forum New To Java
    Replies: 3
    Last Post: 01-15-2012, 06:41 AM
  4. Open external file with external program
    By Wietse de Vries in forum New To Java
    Replies: 1
    Last Post: 12-31-2011, 05:52 PM
  5. Retrieving mouse location inside a thread relative to an external JPanel.
    By Zambash in forum Threads and Synchronization
    Replies: 7
    Last Post: 08-25-2011, 05:33 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •