Package com.sun.embeddedswing

Examples of com.sun.embeddedswing.EmbeddedPeer


                // request focus in main window
                InputManager.ensureKeyFocusInMainWindow();

                // send a fake mouse event to generate an exit
                final EmbeddedPeer targetEmbeddedPeer = lastWindow.getEmbeddedPeer();
                lastWindow = null;
                return new CoordinateHandler() {
                    public EmbeddedPeer getEmbeddedPeer() {
                        return targetEmbeddedPeer;
                    }

                    public Point2D transform(Point2D src, Point2D dst,
                                             MouseEvent event)
                    {
                        if (dst == null) {
                            dst = new Point2D.Float();
                        }
                       
                        dst.setLocation(-1, -1);
                        return dst;
                    }
                };
            } else {
                return null;
            }
        }
        logger.fine("WindowSwing hit");
        logger.fine("Pick hit entity = " + ret.entity);

        EntityComponent comp = ret.entity.getComponent(WindowSwing.WindowSwingViewReference.class);
        assert comp != null;
        final View2D view = ((WindowSwing.WindowSwingViewReference) comp).getView();
        WindowSwing windowSwing = (WindowSwing) view.getWindow();

        // Keep track of the last window we hit
        if (lastWindow == null) {
            logger.fine("Enter swing");
        }
        lastWindow = windowSwing;

        // TODO: someday: I don't think we need to set this anymore for drag events. But it doesn't hurt.
        final Vector3f intersectionPointWorld = ret.destPickDetails.getPosition();
        logger.fine("intersectionPointWorld = " + intersectionPointWorld);

        if (e.getID() == MouseEvent.MOUSE_PRESSED) {
            lastPressPointScreen = new Point(e.getX(), e.getY());

            lastPressEventHook = windowSwing.getEventHook();
            if (lastPressEventHook != null) {
                WindowSwing.EventHookInfo hookInfo = new WindowSwing.EventHookInfo(intersectionPointWorld,
                                                                                   e.getX(), e.getY());
                lastPressEventHook.specifyHookInfoForEvent(e, hookInfo);
            }
        }

        final EmbeddedPeer targetEmbeddedPeer = windowSwing.getEmbeddedPeer();
        CoordinateHandler coordinateHandler = new CoordinateHandler() {

            public EmbeddedPeer getEmbeddedPeer() {
                return targetEmbeddedPeer;
            }
View Full Code Here


        // Note: called on EDT
        private void paintOnWindow(final WindowSwing window,
                final int x, final int y, final int width, final int height) {

            final EmbeddedPeer embeddedPeer = this;

            EventQueue.invokeLater(new Runnable() {

                public void run() {
                    DrawingSurface drawingSurface = window.getSurface();
                    if (drawingSurface == null) return;
                    final DrawingSurfaceBufferedImage.DirtyTrackingGraphics gDst =
                            (DrawingSurfaceBufferedImage.DirtyTrackingGraphics) drawingSurface.getGraphics();
                    gDst.setClip(x, y, width, height);
                    gDst.executeAtomic(new Runnable() {

                        public void run() {
                            embeddedPeer.paint(gDst);
                            gDst.addDirtyRectangle(x, y, width, height);
                        }
                    });
                }
            });
View Full Code Here

    @Override
    public void cleanup () {
        cleanupViews();
        super.cleanup();
        if (embeddedPeer != null) {
            final EmbeddedPeer e = embeddedPeer;
            embeddedPeer = null;

            // OWL issue #74 - be sure to dispose on the AWT event thread
            SwingUtilities.invokeLater(new Runnable() {
                public void run() {
                    e.dispose();
                }
            });
        }
    }
View Full Code Here

TOP

Related Classes of com.sun.embeddedswing.EmbeddedPeer

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.