Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > C++ > Display a C++ window in a java GUI

Reply
Thread Tools

Display a C++ window in a java GUI

 
 
bart59
Guest
Posts: n/a
 
      05-24-2004
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
 
Reply With Quote
 
 
 
 
perry
Guest
Posts: n/a
 
      05-24-2004
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


 
Reply With Quote
 
 
 
 
Thomas Weidenfeller
Guest
Posts: n/a
 
      05-24-2004
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/...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
 
Reply With Quote
 
Alf P. Steinbach
Guest
Posts: n/a
 
      05-24-2004
* Thomas Weidenfeller <(E-Mail Removed)> 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?
 
Reply With Quote
 
bart59
Guest
Posts: n/a
 
      05-25-2004
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.
 
Reply With Quote
 
Prateek R Karandikar
Guest
Posts: n/a
 
      05-26-2004
There exists no such thing as a C++ window.

!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
To iterate is human, to recurse divine.
-L. Peter Deutsch
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
How to start java GUI program WITHOUT additional Windows command line prompt console window? Ulf Meinhardt Java 1 08-10-2009 06:32 AM
window.open - trying to display a new window with a different title - HELP linab2007@gmail.com Javascript 0 05-30-2007 03:09 PM
Can't display Java gui Conrad Eaglehill Java 11 11-10-2004 08:31 AM
GUI - GUI value passing paul.foreman Java 5 10-25-2004 08:06 AM
[PY GUI] interest function in python GUI(wxpython,pyqt) program.wxpython,pyqt ulysses Python 4 10-22-2003 03:28 PM



Advertisments