Display a C++ window in a java GUI

Discussion in 'C++' started by bart59, May 24, 2004.

  1. bart59

    bart59 Guest

    Hi,

    I've got a java program and a c++ one.

    The Java program`s output is a GUI, using swing and awt componants.

    THe Cpp program is a 3D engine: OSG, Open Scene Graph., displaying a
    3D model in the screne, with interaction : so that the user can move
    on the scene, thanks to the mouse or keyboard.

    Actually the Java is used as a command panel fot the 3Dengine.

    I would like to know if i can have the Cpp ouput window (the 3D ouput
    form the OSG cpp)
    in a Java componant > frame or anything : so that I would be able to
    keep all my software in only one main GUI.

    I heard about python to solve my problem if JNI can't, but is it
    possible to do this in Python ?
    What can give me Python that Java can´t ?
    Could nt be more difficult to use a third language ?

    Thanks for you help !

    Bart
     
    bart59, May 24, 2004
    #1
    1. Advertising

  2. bart59

    perry Guest

    myself i wouldn't really think of Python for anything but parsing
    strings and databases for which it was designed. always use the right
    tool for the right job. as for a C++ GUI window inside Java, JNI should
    be able to help you out there. if not you can give JMF a whirl, it was
    designed to interface with all sorts of image rendering devices both in
    and out.... should be a no brianer provided you find an appropaite JMF
    example to go by....

    - perry

    bart59 wrote:
    > Hi,
    >
    > I've got a java program and a c++ one.
    >
    > The Java program`s output is a GUI, using swing and awt componants.
    >
    > THe Cpp program is a 3D engine: OSG, Open Scene Graph., displaying a
    > 3D model in the screne, with interaction : so that the user can move
    > on the scene, thanks to the mouse or keyboard.
    >
    > Actually the Java is used as a command panel fot the 3Dengine.
    >
    > I would like to know if i can have the Cpp ouput window (the 3D ouput
    > form the OSG cpp)
    > in a Java componant > frame or anything : so that I would be able to
    > keep all my software in only one main GUI.
    >
    > I heard about python to solve my problem if JNI can't, but is it
    > possible to do this in Python ?
    > What can give me Python that Java can´t ?
    > Could nt be more difficult to use a third language ?
    >
    > Thanks for you help !
    >
    > Bart
     
    perry, May 24, 2004
    #2
    1. Advertising

  3. bart59 wrote:
    > I would like to know if i can have the Cpp ouput window (the 3D ouput
    > form the OSG cpp)
    > in a Java componant > frame or anything : so that I would be able to
    > keep all my software in only one main GUI.


    Well, if your C++ part renders the data on an own window or region of
    the native operating system, then I would not do it. Little to nothing
    is known about how to integrate a native window into a Java frame.
    There is no public API available in Java to "merge" an entirely native
    component with a Java container. So you would have to do some extensive
    source code study. You need to get the complete source code from Sun,
    especially the native C part, which is not packed with the Java SDK
    (AFAIK available with a special license from Sun). Examining the
    implementation of the native peer of java.awt.Canvas for your platform
    would be a good start.

    If your C++ code just provides the data, then you could use JNI to
    render the data on a Java component like Canvas. An example is given in
    http://java.sun.com/j2se/1.4.2/docs/guide/awt/1.3/AWT_Native_Interface.html
    including some C and Java code.

    Another alternative would be to consider re-writing the C++ part in
    Java, and taking advantage of the existing 3D systems for Java.
    Check comp.lang.java.3d


    /Thomas
     
    Thomas Weidenfeller, May 24, 2004
    #3
  4. * Thomas Weidenfeller <> schriebt:
    > bart59 wrote:
    > > I would like to know if i can have the Cpp ouput window (the 3D ouput
    > > form the OSG cpp)
    > > in a Java componant > frame or anything : so that I would be able to
    > > keep all my software in only one main GUI.

    >
    > Well, if your C++ part renders the data on an own window or region of
    > the native operating system, then I would not do it. Little to nothing
    > is known about how to integrate a native window into a Java frame.
    > There is no public API available in Java to "merge" an entirely native
    > component with a Java container.


    <ot>
    The above is incorrect.
    </ot>

    --
    A: Because it messes up the order in which people normally read text.
    Q: Why is top-posting such a bad thing?
    A: Top-posting.
    Q: What is the most annoying thing on usenet and in e-mail?
     
    Alf P. Steinbach, May 24, 2004
    #4
  5. bart59

    bart59 Guest

    But JAWT should be able to render such a C++ window no ?

    I thought the main problem would come from the mouse interaction on
    the java canvas containing the C++ renderer...

    Sun give some exemples displaying an OpenGl engine in C++ in a Java
    window.
     
    bart59, May 25, 2004
    #5
  6. There exists no such thing as a C++ window.

    !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
    To iterate is human, to recurse divine.
    -L. Peter Deutsch
    !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
     
    Prateek R Karandikar, May 26, 2004
    #6
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Andrew Bewley via DotNetMonster.com

    window to window communication (window.opener)

    Andrew Bewley via DotNetMonster.com, Feb 3, 2005, in forum: ASP .Net
    Replies:
    0
    Views:
    1,091
    Andrew Bewley via DotNetMonster.com
    Feb 3, 2005
  2. paul.foreman

    GUI - GUI value passing

    paul.foreman, Oct 22, 2004, in forum: Java
    Replies:
    5
    Views:
    792
    Michael Rauscher
    Oct 25, 2004
  3. Conrad Eaglehill

    Can't display Java gui

    Conrad Eaglehill, Nov 8, 2004, in forum: Java
    Replies:
    11
    Views:
    18,639
    Rogan Dawes
    Nov 10, 2004
  4. Ulf Meinhardt
    Replies:
    1
    Views:
    1,002
    Andrew Thompson
    Aug 10, 2009
  5. Replies:
    0
    Views:
    139
Loading...

Share This Page