Handle to Java Frame in C

I would like to obtain the handle to a Java window......
jawt gives only the handle to a canvas.....
Please help me out.....This is urgent.......

Obtaining the handle to the canvas is, as you have found out, of little use to you.
However you can pass the (J)Frame object to your native code as part of some initialisation process and cache a GlobalRef to that object at the native side.
Once you have that global reference you can call any of the Frame methods you like. Don't forget, to make any Java call from the native side you need to get a valid JNIEnv, so you should either use (*jvm)->GetEnv.. method or jint result= (*jvm)->AttachCurrentThread...
In order to have a reference to the virtual machine, you need to add the following code to your native..
global reference
JavaVM *jvm;
then
JNIEXPORT jint JNICALL JNI_OnLoad(JavaVM vm, void reserved) {
jvm = vm;
return JNI_VERSION_1_2;
}

Similar Messages

  • How can  we see the desktop through a java frame by using JNI?

    How to make a java frame transparent( so that we can see the desktop through it) by JNI? I have seen some code to take a snapshot of the desktop. But is there any code so that the desktop is fully or partially visible through a frame?
    laks

    Please take your time to write full words: "you" instead of "u", "your" instead of "ur". It makes your posts a lot easier to read, especially for those of us who don't have English as their native language.
    You can not really "modify" the behaviour of a method by using a proxy, but you can create a proxy, direct all but one method to the original method and provide a separate implementation for the target method.
    This way you'll have two objects with the same interface (not only in the Java sense, but all methods look the same), but differing behaviour: the original object and the proxy.
    Now if you pass around the proxy instead of the original object, then it'll look as if you changed the behaviour of your object.

  • How to embed an external player in a java frame?

    Hello
    I want to use virtual dub player ( which has the capability of playing the video frame by frame and also normally) for some analysis of videos. But I want to embed the player in a java frame and draw some lines on the video. How can i embed the virtual dub player in a java frame?
    laks

    Look at:
    Slight oversight in the Concepts guide regarding external tables
    http://download-uk.oracle.com/docs/cd/B19306_01/server.102/b14220/schema.htm#sthref777

  • How to handle the java.policy file ?

    Can somebody tell me how to handle the java.policy file?
    I always get java.net.SocketExceptions and java.security.AccessControlExceptions while connecting to an appserver from an applet.
    What do I have to write in the java.policy file, where do I have to place it and do I have to call it in some way form my applet?
    Thanks in advance.
    don call

    The java.policy file goes in your jre installation directory in .../jre/lib/security (there should be one there already).
    I used it to allow otherwise restricted permissions for an applet using javax.comm. Add something like the following to the file:
    grant codeBase "URL:http://yourDomainName/rootDirectoryOfYourApp/*" {
         permission java.security.AllPermission;
    This will give the applet downloaded from your site all permissions. You might want to give only certain permissions, I don't know.
    Teri

  • DISPLAY SPATIAL DATA USING JDBC ON A JAVA FRAME

    I am trying to set up some spatial data and need help in getting some sample
    code for displaying the data on a Java Frame using JDBC.
    The shapes I am setting up are simple polygons, lines, circles. I was going
    through the samples in the demo directory under $ORACLE_HOME/md/demo/examples, but could not find any JDBC
    I would really appreciate if you can point me towards some sample code and any other spatial resources.
    Madhukar

    Here you go. It uses JDBC to fetch geoms, convert them into Java JGeometry objects, which then create Java2D shapes (these are functions of the public sdoapi.jar library). It then uses some class in the sdovis.jar library (the rendering engine of MapViewer) to setup the necessary viewport transform. If you know how to setup the viewport transform, then you dont even need sdovis. sdovis.jar is found in an deployed MapViewer's WEB-INF/lib directory. Or you can extract it from the mapviewer.ear's web.war file.
    import java.awt.*;
    import java.awt.geom.*;
    import java.awt.event.*;
    import java.awt.image.*;
    import java.sql.*;
    import javax.swing.*;
    import javax.swing.event.*;
    import java.util.*;
    import oracle.jdbc.OracleDriver;
    import oracle.sdovis.*;
    import oracle.sdovis.style.*;
    import oracle.sdovis.util.*;
    import oracle.spatial.geometry.JGeometry;
    import oracle.sql.STRUCT;
    * A very simple program that shows stuff from db in a JFrame
    * <p>
    public class tilsvgui2 extends JFrame
      final static int mapWidth  = 640;
      final static int mapHeight = 480;
      static JSDOGeometry geom = null;
      public tilsvgui2()
        setSize(mapWidth+40, mapHeight+40);
                    setVisible(true);
        this.addWindowListener(new java.awt.event.WindowAdapter() {
          public void windowClosing(WindowEvent e) { System.exit(0); }
            public void paint(Graphics g)
                    super.paint(g);
        int w = this.getWidth(), h = this.getHeight();
        Insets inset = this.getInsets();
        double[] mbr = geom.getMBR();
        //from sdovis; it will setup the viewport transform
        XFViewPort xfp = new XFViewPort();
        xfp.setDeviceView(inset.left, inset.top, w-inset.left-inset.right-1, h-inset.top-inset.bottom-1);
        xfp.setDataView(mbr[0], mbr[1], mbr[2], mbr[3]);
        AffineTransform af = xfp.getAffineTransform();    //get the viewport transform
        Shape shp = geom.createShape(af);    //create a proper shape that fits the viewport
        Graphics2D g2 = (Graphics2D) g;
        g2.setColor(Color.red);
        g2.drawRect(inset.left, inset.top, w-inset.left-inset.right-1, h-inset.top-inset.bottom-1);
        //draw the shape itself
        g2.setColor(Color.blue);
        g2.draw(shp);
      public static void getStuff() throws Exception
        System.out.println("Loading geometry...");
        Connection conn = getConnection("mapsrus.us.oracle.com", "1521", "orcl", "scott", "tiger");
        Statement  stmt = conn.createStatement();
        ResultSet  rset = stmt.executeQuery("select geom, totpop from counties where county='Merrimack' and state_abrv='NH'");
        while(rset.next())
          STRUCT st = (STRUCT) rset.getObject(1);
          geom = JSDOGeometry.loadFromDB(st);
          int population = rset.getInt(2);
          break; //displaying only the first geometry
        rset.close();
        stmt.close();
        conn.close();
      private static Connection getConnection(String host,
                                              String port,
                                              String sid,
                                              String username,
                                              String password)
        throws SQLException
        String thinConn = "jdbc:oracle:thin:@"+host+":"+port+":"+sid;
        Driver d = new OracleDriver();
        Connection conn = DriverManager.getConnection(thinConn,username,password);
        conn.setAutoCommit(false);
        return conn;
      public static void main(String[] args)
        try{
          getStuff();
        }catch(Exception e)
          e.printStackTrace(System.err);
        new tilsvgui2();
    }

  • Urgent!Java Frame Cutting according to non-rectangular image (Transparency

    Urgent-Java Frame Cutting according to non-rectangular image (CrossPlatform - Transparency)
    hi, i want to make the frame transparent in order to make a skin like Windows Media Player . skin is non-rectangular how should i make the frame transparent i am using the JWindow as the container. Plz guide me any idea. as an example i have a JWindow i put a non-rectangular image on it via Jlabel . now i want to make the edges of JWindow outside the boundery of the image transparent ... so that my frame seems like a non-rectanguar image . How i do that? But i need a cross platform kinna thing in java especially for windows/mac/linux
    PaulFMendler :: thanks for ur help i looked at the code but it seems to be windows dependent. i need cross-platform way of producing abt effects. please contact me even on my email >> [email protected]
    Waiting ......

    Check out the link shown below:
    http://forum.java.sun.com/thread.jsp?forum=4&thread=391403
    The posted code has slight problem when moving the JWindow around but you can get a pretty good idea on what has to be done.
    ;o)
    V.V.

  • Is File handling in Java Swing possible?

    Hi I need to know whether file handling in Java Swing is possible or not?

    cents wrote:
    Thanks for ur answer.....Actually I just wanted to know whether "Reading from a file" and "Writing to a file" in Java Swing is possible or not?
    Edited by: cents on Mar 16, 2010 9:35 AMWhat did google tell you? Did you see anything interesting in the API?

  • Study security related exception handling in Java

    Hi all,
    I am required to do an indepth study on security-related exception handling in Java, their Pluses and minuses... Can ppl suggest me places where I can get a kick start? Any resource that u know can help me out?
    I appreciate ur help in this regard...FYI, I am a grad student and I am doing this as a part of my course-work...I am writing up a report on this...
    Thanx a bunch, in advance for ur help ppl..

    Take a look at the JAAS API and docs.
    - Saish

  • Attaching window system tray icon events to java frame

    I need to bring java frame to front on an event with the icon placed in the system tray. Like if I click the mouse on it.. the frame should come to front.
    Any body who can help, I will really appreciate.
    Thanks in advance
    Zeeshan

    I am very interested in implementing just such a thing with my Java application. I am in the starting phases of this project and ran across your post in my search for info.
    How much do you already have implemented? I.E., can you display the icon but are just having trouble catching the events for when the icon is clicked? Or do you not even have the ability to display the icon yet? I have found the Windows documentation on the MSDN site for the shell function Shell_NotifyIcon(), which is what we want to use but I have not begun any attempts to use it yet.
    If you (or anyone else) have any info or have had any success at all with this yet, I would be very interested in hearing how it works. I'll be happy to share any info I find, when/if I get that far.
    Thanks,
    j

  • What's different between event handle by bsp frame & MAC

    Hi,
    Can anyone know the different between event handle by BSP frame & handle by MAC?
    and how to know which event is handle by BSP frame or MAC?
    thanks
    Gang

    Hi Abdul,
    So that means the add_entry event is standard event handle by BSP frame.
    thanks
    Gang

  • How to access the handle of  the Frame window ?

    How to access the handle of the frame window through out the application ?. I want to display an alert box, while I click the fifth inner child component of the Frame . I am using Dialog Class for the alert box, I have to pass the frame handle to the Dialog constructer, I am getting the handle of the frame by getParent().getParent()......getParent().. But can any one suggest any better solution.

    If you application extends Frame or JFrame, you could simply refer to "this", or if you create a global or final Frame object that you use as your "top-level" component, you could refer to it this way. Additionally, if you're ever in a situation where you really need to go all the way to the top through n levels of components, I believe you could always do something like this...
    // assume myContainer is the "child" component that you're on, and you want to find its top-level parent
    Container c = myContainer;
    while (c.getParent() != null) {
         c = c.getParent();
    }

  • Handling apllication java.Exceptions

    I've developed an Weblogic WebService Application with several webservices inside.
    They are working fine but when a WebService throws a java Exception this exception is putted inside a SoapFaultException.
    After some research I figured that I should create my own Exceptions that inherits from SoapFaultException to best format the exception message
    my clients will receive, ok it is done and it's working. Now I need to handle all java Exceptions (witch were not throw by me) to put it in my own Exceptions witch inherits from soapFaultException. Does anybody know if I can implement an Exception handler that will capture all java Exceptions unhandled by my applicatio.
    I'm using WLS 9.2.

    Rethrow an exception and catch it in the call in JavaFX code?

  • How Keyboard & Mouse Events are handled in java?

    Hi
    How Keyboard & Mouse Events are handled in java?
    Kindly brief, how a key typed in the keyboard is sensed and it is entered in JTextField?
    or
    Pls. give me some links.
    Am going to send the events from external device (like keyboard) to OS and from that I need to capture that event in Java Swing?
    Pls. drop in a bit. So that it will be helpfull to me.
    Thanks in advance,
    bee

    Actualy am very much aware of using KeyListener and MouseListener. I am in need of internal details,
    how typing a key in keyboard is captured by KeyListener? How the event is passed to java swing and and it is fired to keylistener.
    Pls. help me.
    Thanks
    bee

  • Move Java Frame into Windows taskbar notification area (system tray)?

    Hi,
    I was wondering if anyone has written a service-like application in Java running (and appearing) in the Windows "taskbar notification area", instead of running in the convential Windows taskbar.
    I'm able to add an icon to the taskbar notification area (frequently errorneous called as the 'system tray') by using some native code that uses win32 Shell_NotifyIcon(.. , ..). However, I'm not able to 'couple' the window (i.e. the Java frame) to the new icon in the taskbar.
    My icon is shown in the area AND the frame is shown as an application in the taskbar... I would like to 'remove' my Java application from the taskbar and place it 'as an icon' in the taskbar notification area.
    Has anyone had experience with a similar problem?
    Many thanks!
    Jasper

    If all you need is to make the frame not visible in the taskbar as well than why don't you activate the hide() method? cature the minimize event and activate the frame.hide(); method. And in the system tray make the frame visible by frame.show();

  • How to create sql database using java frame or appelet?

    hi ! i am working on database project i want to create a database using java frame or applet where it asks user to select the location for database to be created , after user have specified the path then the programs creates the database, again i want that database to be read and write by another frame or applet but as user select the path how do i make the connectivity. i just have basic knowledge on java. please give me idea how can i process further.
    thanks a lot

    While duffymo is correct in regard to most major database products, it's my understanding (warning! wild-ass guess coming) that the Hypersonic DB is more "application-centric" and the dynamic creation of databases is part of its design. It's pure Java database software, and therefore is not appropriate for all database projects, in particular those that require extremely high-performance.
    See http://hsqldb.org/
    I've not used it yet (but soon though), and I can't really advise anyone about it.
    However, I'm wondering if you phrased you question in a way that is confusing us. To most of us in casual conversation, a "database" is both (1) a large organized collection of data and (2) the software that is used to organize and access it. However, the phrase "create a database" usually means creating a (1) database (a collection of data) using an already created (2) database software, such as Oracle, MySQL, DB2, HSQDB, etc., etc. If you'r question is, how do a create some new database software using Java, the answer is that this is a very very big and hard thing to do for the general case and probably not something you want to be doing.

Maybe you are looking for

  • Mod_osso partner application and webcache site to server mapping

    hi, need advice on the following. i have an app server container (only OC4J and no portal,forms etc) hostname abc.test.net installed with the option to registered to the sso server (http://mylogin.test.net), which is on a physically seperate machine.

  • Regarding replication configurations in oracle 9i

    Good Morning... In my current project,I have 3 databases like A,B and C.now i need to create materialized views on B & C database using dblink(created on A database), then i need to refresh around 70 tables for every 1 hour. so in this regard i need

  • Can i customize the adjustment window in aperature

    1. Can I customize the Adjustment window so that I don't have to go to "Add adjustment" for each picture to add crop, etc? 2. Can I customize the settings in the adjustment window so they are fixed for each picture? Thank you

  • Is there a selfie stick for an iPad Mini?

    Is there a selfie stick suitable for use with an iPad Mini?

  • Antivirus for Nokia 808 Pureview White

    Please kindly suggest me the best free antivirus which i can install and which is compatible with my nokia 808 pureview white.... The installed antivirus F-Secure in my mobile is going to expire tomorrow.....  Solved! Go to Solution.