Display a C++ window in a java GUI

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.

You can create a child native window in a java component. For this do as follows
- extent java.awt.Canvas class with yours, override method addNotify and add some native method for CPP window initialization, g.e. createWindow()
- in your addNotify call createWindow():
public void addNotify() {
    super.addNotify();
    createWindow();
}- add native method nativeWindowResize(int width, int height) to resize CPP Window;
- implement java.awt.event.ComponentListener and in method componentResized call nativeWindowResized:
public void componentResized(java.awt.event.ComponentEvent componentevent) {
    nativeWindowResize(getWidth(), getHeight());
}- override setBounds(int x, int y, int w, int h):
public void setBounds(int x, int y, int w, int h)
    super.setBounds(x, y, w, h);
    nativeWindowResize(getWidth(), getHeight());
}What to do in JNI code (method createWindow and nativeWindowResize):
- get HWND of java.awt.Canvas Object with AWT native interface;
- create your CPP window as a child of Canvas' window;
- in JNI method nativeWindowResize resize your CPP window.
This is very simple task.

Similar Messages

  • Error in opening the display on local windows machine for DBCA GUI from rem

    Hi Chaps,
    I connected remote machine using SSH putty from my windows local PC
    I set the environmnet on my remote linux5 mahcine as
    $export DISPLAY=10.96.5.153:0.0
    and ran xclock on remote machine to see the GUI on my local machine(10.96.5.153). unfortunately I got an error
    'Error: Can't open display: 10.96.5.153:0.0'
    the whole idea of doing above is to invoke DBCA GUI on my local machine
    can you please enlight your experience? any solution to this will be appreciated.
    Thanks
    QA
    Edited by: QAbdul on May 11, 2010 3:55 AM

    Hi QA;
    I set the environmnet on my remote linux5 mahcine as
    $export DISPLAY=10.96.5.153:0.0
    and ran xclock on remote machine to see the GUI on my local machine(10.96.5.153). unfortunately I got an error
    'Error: Can't open display: 10.96.5.153:0.0'you are using X-forwarding? Or you are using program as VNC or Xming?
    If you are using VNC you have to follow:
    1. Check vnc is running or not
    service vncserver status << if its return Xvnc stopped
    service vncserver start
    2. vncserver (if you run first time it will ask you password, enter valid password)
    3. as a root user
    export DISPLAY=linux_machine_hostname(or IP of linux):1.0
    xhost +
    4. run Vncviwer from ur machine then enter
    linux_machine_hostname(or IP of linux):1.0 and pass
    5. From vnvviwer screen
    su - oracle
    Then you can run DBCA
    Regard
    Helios

  • How to display a javafx window from a java program?

    hello,
    I found in the help how to call a java class from a javafx class, but how can I do the opposite : make a javafx window visible and active from a java class (main method e.g.)?
    thank you,
    olivier.

    I haven't studied the topic, but I stumbled upon a good number of threads and blog articles on how to use JavaFX in Swing...
    Basically it is hackish (might depend on current implementation, thus break on new releases) because Sun didn't designed it for this task.

  • Updating a Java GUI with c++

    Hi,
    I've been working with JNI for a few months now, but I am struggling with an important piece of the application I'm creating. What I have is a Java GUI which I use to create an existing c++ application through JNI. What I would like to do is have the c++ print all of its output to a window within the Java GUI. I thought surely others have wanted to do the same thing, but I have not found any threads addressing the idea. Here is what I've tried/thought of so far without success:
    1) I could have Java poll the c++ application to see if there are any updates to be printed, but that seems clunky and I'm not even sure how well it would work. I would like it to print as it happens (i.e. have c++ tell the gui to print as it becomes available)
    2) It seemed intuitive that I could simply pass the JNIEnv pointer, methodID, and the object to the c++ class to be stored for later use. But after it crashed I found a thread (http://forum.java.sun.com/thread.jspa?threadID=755242&tstart=225) which says you should never pass the JNIEnv (I don't know why). This same thread also gave some suggestions on how to attach to a current thread and then destroy, but also mentioned that once you destroy the VM, it can't be recreated and that won't work for me.
    Any suggestions are greatly appreciated.
    -Mark

    And before anyone says "Google" or "check the documentation" I've torn through the MATLAB (mathworks) site and read every page that even mentions Java (beans or otherwise) and I've googled, trust me I've googled.

  • Displaying  then submitting a CAPTCHA in Java

    Hello,
    How would it be possible to display a web CAPTCHA in a Java GUI, have the user enter the letters in the CAPTCHA, and then press a "submit" button and have the CAPTCHA verified?
    Basically I need to get a URL, read the CAPTCHA image path and download the image, but maintain the state of the connection so that the CAPTCHA code is successfully verified. Any ideas?
    Is it just a case of ensuring that I use the same connection to first access the initial URL, download the CAPTCHA image, and then post the value back?
    I know that it can be done as I've seen it in other applications....
    Thanks,
    BBB

    are you trying to build a spamming engine?

  • JAVA GUI window content does not fill out when window is enlarged (Win,Mac)

    I've been using the SAP JAVA GUI on a Windows XP workstation as well as a couple of MacBooks running OS X over the last year and a half or so, running versions from 7.10 r 7(maybe earlier) thru 7.10 r 10 (installed today.) The GUI has performed generally well on these platforms, but has one major irritation.
    When I open certain pop-up windows, such as the SPAD [List of Output Requests > Status Description |http://img171.imageshack.us/i/screenshot20091006at241.png/|screenshot], it usually does not open a  large enough window to display all the data - one must scroll horizontally and/or vertically to see the entire window content.  The real aggravation is that if [one enlarges the window|http://img101.imageshack.us/i/screenshot20091006at242.png/|screenshot] so as to see more data, the resizing is ignored.  The contents of the window are still displayed within the original window boundaries instead of filling out the expanded window.   It is not possible to get the entire window contents displayed, it is still necessary to scroll around.
    What am I missing here?   How can I get window resizing to work correctly?   (Or is there a way to make such windows at least open up at a larger initial size??)
    I only found one other thread in this forum, Sap gui screen size in ubuntu., which seemed to be addressing the same problem, but the suggestion was to apply the latest patch to the GUI and get JAVA 1.6.   One would think that since that post in 2008, any patches would have made it into the latest revisions.  I'm already running Java 1.6.
    SAPGUI for Java 7.10 rev 10
    (Version ID 071000041000)
    Tue Sep 8 09:49:53 MEST 2009
    uw1059, 710_REL, 1093492
    Java VM: Apple Inc. Version 1.6.0_15
    OS: Mac OS X(i386) Version 10.6.1
    SAPGUI for Java 7.10 rev 10
    (Version ID 071000041000)
    Tue Sep 8 09:49:53 MEST 2009
    uw1059, 710_REL, 1093492
    Java VM: Sun Microsystems Inc. Version 1.6.0_15
    OS: Windows XP(x86) Version 5.1
    Any suggestions?  Anyone else even seeing this?
    Thanks!
    Rich

    I'm now running
    SAPGUI for Java 7.10 rev 11
    (Version ID 071000041100)
    Tue Dec 8 16:04:41 MET 2009
    uw1059, 710_REL, 1119101
    Java VM: Apple Inc. Version 1.6.0_17
    OS: Mac OS X(i386) Version 10.6.2
    I've also updated my XP system to 7.10 rev 11 and both continue to display the same failure to resize corrrectly.  
    Here's a [video capture of this behavior|http://img163.yfrog.com/i/sapresizebug.mp4/].
    Given that installs on two separate operating systems have consistently misbehaved like this, I have a hard time believing it is something  we are doing.  (But not that hard...)  I find it hard to believe that is the way these screens present on most SAP sites...
    Any comments or suggestions would be welcome!
    Rich

  • PosDM Workbench on Java GUI

    Has anyone been able to work with the PosDM Workbench with the Java GUI?
    The selection screen comes up fine but but it dumps just before displaying transactions. Is this a problem with the Java gui and is there a way to get it to work?

    Unfortunately not.
    The Windows GUI uses special ActiveX controls (or COM objects) that are not rebuilt for Java, I think the main reason for this is, that they are bought externally and not developed by SAP.
    The only thing that stays left is to use the Windows GUI (using Terminal Server, Citrix and/or Wine/Crossover).
    Markus

  • Java GUI in same frame

    Hi,
    Using the Bean area I was able to bring up Java GUI on the client side. This Java GUI is displayed outside the Oracle main frame. Is there any way to show these Java GUI's under the same Oracle frame itself?
    -murali

    murali,
    I think that there is no straight and easy answer to this and one would have to drill down into how a Forms is composed in the client Applet. You will have to check if MDI is used as a runtime parameter and then get a hold to the Forms Window. Also, you will have to use ewt classes to build the GUI to make sure the look and feel is the same. I don't have an answer for you, but its an interesting challenge to face.
    frank

  • New Features for Java GUI

    Hello everyone!
    Can anybody tell about new features in SAP GUI for Java. I think It's emasculate now. It doesn't contain New ABAP editor, Network graphic, normal Screen Painter... I really enjoy adding themes and other stuff, but when these functionality will be added?
    Thanks.

    Hi,
      I use Java GUI from version 6.40, so i didn't know new ABAP editor for years. Once somebody shows me its features ...and I found that it is really good editor compared with previous Notepad-like frontend editor. But I have to say that customized version od Gvim used as external editor is in 90% better then new ABAP editor (the only problem is that double click on object doesn't work, but some workarounds are known for double-click on locally defined objects).
    Graphical screen painter is generally good tool, but once I cannot find any feature (sorry, I forgot which one, it happens about 6 years ago). I ask a SAP guru sitting near me. He comes, switch graphical screen painter off and click to a box in non-graphical version of screen painter. Then he told me that some features are not accessible in graphical screen painter. It was last time I used graphical version of screen painter.
    Themes? Works .... at least for me (Linux 32 bit and now Linux 64 bit too).
    So I think that Java GUI is usable (at least on Linux/Mac, I am not sure how in works under Windows) but you cannot stick on all features (and maybe you can find better working variants of it). E. g. I have no problem with new ABAP editor, it would be much better for me, if I can open external editor clicking to "Change" button in SE38 directly instead of click plus selecting external editor from menu.
    Regards,
      Pavel

  • Cannot connect a Java GUI client to an EJB

    I am having problems trying to make a Java GUI client connect to an EJB. I am using JRun4.
    At first, I tried making the Java GUI client a part of the enterprise application that I am building (of which the EJB is a part of). I included the client as a Java module in the application.xml of the enterprise application.
    However, when I try to start the server, containing this application, I get an error saying:
    Application authentication required. Incorrect method call.
    Now when I try to execute the application from the console, it works fine except when it comes to the part when it has to connect to the EJB. At this point I get an java.lang.reflect.UndeclaredThrowableException. Here's the stack trace:
    java.lang.reflect.UndeclaredThrowableException
    at $Proxy1.create(Unknown Source)
    at mds.Caller.actionPerformed(Caller.java:135)
    at javax.swing.AbstractButton.fireActionPerformed(Unknown Source)
    at javax.swing.AbstractButton$ForwardActionEvents.actionPerformed(Unknown Source)
    at javax.swing.DefaultButtonModel.fireActionPerformed(Unknown Source)
    at javax.swing.DefaultButtonModel.setPressed(Unknown Source)
    at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(Unknown Source)
    at java.awt.Component.processMouseEvent(Unknown Source)
    at java.awt.Component.processEvent(Unknown Source)
    at java.awt.Container.processEvent(Unknown Source)
    at java.awt.Component.dispatchEventImpl(Unknown Source)
    at java.awt.Container.dispatchEventImpl(Unknown Source)
    at java.awt.Component.dispatchEvent(Unknown Source)
    at java.awt.LightweightDispatcher.retargetMouseEvent(Unknown Source)
    at java.awt.LightweightDispatcher.processMouseEvent(Unknown Source)
    at java.awt.LightweightDispatcher.dispatchEvent(Unknown Source)
    at java.awt.Container.dispatchEventImpl(Unknown Source)
    at java.awt.Window.dispatchEventImpl(Unknown Source)
    at java.awt.Component.dispatchEvent(Unknown Source)
    at java.awt.EventQueue.dispatchEvent(Unknown Source)
    at java.awt.EventDispatchThread.pumpOneEventForHierarchy(Unknown Source)
    at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
    at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
    at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
    at java.awt.EventDispatchThread.run(Unknown Source)
    Caused by: jrun.ejb.invocation.ContainerNotFoundException: The EJB container for boss-ejb#Boss could not be found.
    at jrun.ejb.invocation.AbstractInvocationProxy.findContainer(AbstractInvocationProxy.java:58)
    at jrun.ejb.invocation.LocalInvocationProxyImpl.invoke(LocalInvocationProxyImpl.java:53)
    at jrun.ejb.invocation.ClientInvocationHandlerImpl.invoke(ClientInvocationHandlerImpl.java:198)
    ... 25 more
    Since the bean is local, I am using a local reference to the bean in the lookup in the code of the client:
    Object o = context.lookup("local/BeanTest")
    I tried to use:
    Object o = context.lookup("java:comp/env/ejb/BeanTest")
    and added an ejb-local-ref in the application-client.xml file of the client. But when I try executing the client in this case, I get an error saying:
    No such binding: ejb
    I wish someone can help me out with this. My main aim is to get the app client talk to the EJB. Thanks a lot in advance.
    Soham

    I am not sure of a tool to view the JNDI tree. I have one in Weblogic console. But you can check the JNDI names with a small sample code.
    import java.util.*;
    import javax.naming.*;
    import javax.rmi.PortableRemoteObject;
    public class TestEnvironment {
        public static void main(String[] args) {
            Context context   = null;
            Object object     = null;
            // Hashtable for environment properties.
            Hashtable env = new Hashtable();
            env.put(Context.INITIAL_CONTEXT_FACTORY, "weblogic.jndi.WLInitialContextFactory");
            env.put(Context.PROVIDER_URL, "t3://localhost:7001");
            try {
                context   = new InitialContext(env);
                NamingEnumeration enum = context.listBindings("");
                while (enum.hasMore()) {
                    Binding binding = (Binding) enum.next();
                    System.out.println("Name: " + binding.getName());
                    System.out.println("Type: " + binding.getClassName());
                    System.out.println("Value: " + binding.getObject());
            } catch (Exception exception) {
                exception.printStackTrace();
    }Hope this helps.

  • Windows 7 and Java

    Hey,
    I have been testing my applications I have written in java since Windows 7 RC's had first started being released.
    Finally after installing the retail ultimate edition... the results from Java GUI related stuff is still as it was since Windows 7's first release.
    Resizing of JFrame's gives a serious flicker on GUI especially when using substance look and feel, (black background beneath the standard gui)
    For example, resizing net beans in xp is perfect, but resizing it in Windows 7 gives a black background and an extremely slow repaint.
    I hope this gets resolved soon... is there anything being done or some sort of work around?
    thanks!
    javdax

    hii,
    nb supported Vista on "http://www.netbeans.org/community/releases/67/relnotes.html#system_requirements",
    1/ be sure that's win7 is 1.st service pack for Vista, nothing else, vista core 6.0 and win7 core 6.01,
    2/ xp and vista is strict only 32-b,
    3/ have you win7 - 32-b, or 64-b
    4/ JVM 6 for 32-b or 64-b "http://java.com/en/download/faq/java_win64bit.xml"
    5/ check if is JDK and SDK correctly instaled, (JDK 6)
    6/ nb correctly runs on win2003 64-b(xp core) or win2008 64-b (vista core), JVM 6, JDK 6, JDK 5,
    or
    7/ instal that's on xp mode
    ... kopik

  • Forte For Java GUI Editor

    Hi everyone,
    I've been trying to switch usage between Forte for Java running on 2 platforms (Win NT and Solaris 8). For this reason, I want to try to use the GUI Editor in each. But when I tried copying the same .class file from one platform to another and running opening the file under Forte for Java, the GUI Editor doesn't show up the form and Component Editor. Is there a way to make Forte for Java able to recognize the GUI components in a class file not creatd in Forte or not in that version of Forte? Thank you for any help!
    Bob

    Hi,
    this happens not just with class file but also with .java
    file. I created a GUI with Forte ( on windows ) and because I did not jave runtime setup on windows, I copied, java file that was created to the unix env. Then added some code to it and copied back to the windows.
    After that, GUI editor never came up. I lost all that I did
    to create a GUI. Now I can modify GUI only manually.
    I you have found answer to this, please let meknow
    at [email protected]
    rgds,
    sam

  • How to display IndexedFaceSet from .wrl file to Java 3D using cv97 package.

    Dear everyone,
    I'm trying to load a VRML file containing some IndexedFaceNode to Java3D using cv97 package written by Shatoshi Konno (http://www.cybergarage.org/vrml/cv97/cv97java/index.html).
    I use the code as below.
    However, there is nothing displaying in the window when I run this code.
    Does anyone have experience on this. Could you give me some suggestion?
    Thanks a lot!
    ======================================================
    import cv97.Constants;
    import cv97.SceneGraph;
    import cv97.j3d.SceneGraphJ3dObject;
    import cv97.node.Node;
    import cv97.node.PointLightNode;
    import java.awt.BorderLayout;
    import java.awt.Frame;
    import java.awt.event.WindowAdapter;
    import java.awt.event.WindowEvent;
    import javax.media.j3d.AmbientLight;
    import javax.media.j3d.Canvas3D;
    public class ViewerJ3D extends Frame implements Constants {
       private SceneGraph   mSceneGraph;
       private SceneGraphJ3dObject mSceneGraphObject;
       public ViewerJ3D(){
          super("VRML Simple Viewer");
          mSceneGraph = new SceneGraph(SceneGraph.NORMAL_GENERATION);
          mSceneGraph.load("model\\model.wrl");
          setLayout(new BorderLayout());
          Canvas3D c = new Canvas3D(null);
          add("Center", c);
          mSceneGraphObject = new SceneGraphJ3dObject(c, mSceneGraph);
          mSceneGraph.setObject(mSceneGraphObject);
          setSize(400,400);
          show();
          addWindowListener(new killAdapter());
          setVisible(true);
       static class killAdapter extends WindowAdapter {
           public void windowClosing(WindowEvent event) {
              System.exit(0);
      public static void main(String args[])
          ViewerJ3D view = new ViewerJ3D();
    }=======================================================

    Dear everyone,
    I'm trying to load a VRML file containing some IndexedFaceNode to Java3D using cv97 package written by Shatoshi Konno (http://www.cybergarage.org/vrml/cv97/cv97java/index.html).
    I use the code as below.
    However, there is nothing displaying in the window when I run this code.
    Does anyone have experience on this. Could you give me some suggestion?
    Thanks a lot!
    ======================================================
    import cv97.Constants;
    import cv97.SceneGraph;
    import cv97.j3d.SceneGraphJ3dObject;
    import cv97.node.Node;
    import cv97.node.PointLightNode;
    import java.awt.BorderLayout;
    import java.awt.Frame;
    import java.awt.event.WindowAdapter;
    import java.awt.event.WindowEvent;
    import javax.media.j3d.AmbientLight;
    import javax.media.j3d.Canvas3D;
    public class ViewerJ3D extends Frame implements Constants {
       private SceneGraph   mSceneGraph;
       private SceneGraphJ3dObject mSceneGraphObject;
       public ViewerJ3D(){
          super("VRML Simple Viewer");
          mSceneGraph = new SceneGraph(SceneGraph.NORMAL_GENERATION);
          mSceneGraph.load("model\\model.wrl");
          setLayout(new BorderLayout());
          Canvas3D c = new Canvas3D(null);
          add("Center", c);
          mSceneGraphObject = new SceneGraphJ3dObject(c, mSceneGraph);
          mSceneGraph.setObject(mSceneGraphObject);
          setSize(400,400);
          show();
          addWindowListener(new killAdapter());
          setVisible(true);
       static class killAdapter extends WindowAdapter {
           public void windowClosing(WindowEvent event) {
              System.exit(0);
      public static void main(String args[])
          ViewerJ3D view = new ViewerJ3D();
    }=======================================================

  • Help frame is not opening to user, but displayed on the windows status bar.

    Hi All,
    In my application help frame is displaying on the windows status bar. But when i click on the icon it is not displayed on the desktop.
    This is not happening again to reproduce it.
    If you have faced this problem anytime, please let me know.
    May be a problem with the windows OS.
    In general, is there any case that, java Frame behaves like this?
    Regards,
    Nar

    Have you currently got private browsing enabled : Settings > Safari > Private Browsing 'on' ?

  • How to invoke Outlook Express to send mail in a JAVA GUI

    hi..
    i want to send a mail thru a java GUI...but when i press submit button..it has to invoke MS Outlook express and send the mail via this.
    pls reply soon..
    bi..

    Hi,
    When I execute the command like "Runtime.getRuntime().exec("cmd /c start mailto:[email protected]?subject=Test&body=Hello");" in my java program,There is no boby in my outlook window .could you give me some suggestion? Thank you very much!
    source:
    import java.io.IOException;
    public class TestAutoSendEMail {
         public static void main(String[] args) {
              try {  
                   Runtime.getRuntime().exec("cmd /c start mailto:[email protected]?subject=Test&body=Hello");
         catch (IOException ex) {  
         System.out.println(ex.getMessage());
    }

Maybe you are looking for