Search in sources :

Example 16 with ComponentPeer

use of java.awt.peer.ComponentPeer in project jdk8u_jdk by JetBrains.

the class BasicSplitPaneUI method startDragging.

/**
     * Should be messaged before the dragging session starts, resets
     * lastDragLocation and dividerSize.
     */
protected void startDragging() {
    Component leftC = splitPane.getLeftComponent();
    Component rightC = splitPane.getRightComponent();
    ComponentPeer cPeer;
    beginDragDividerLocation = getDividerLocation(splitPane);
    draggingHW = false;
    if (leftC != null && (cPeer = leftC.getPeer()) != null && !(cPeer instanceof LightweightPeer)) {
        draggingHW = true;
    } else if (rightC != null && (cPeer = rightC.getPeer()) != null && !(cPeer instanceof LightweightPeer)) {
        draggingHW = true;
    }
    if (orientation == JSplitPane.HORIZONTAL_SPLIT) {
        setLastDragLocation(divider.getBounds().x);
        dividerSize = divider.getSize().width;
        if (!isContinuousLayout() && draggingHW) {
            nonContinuousLayoutDivider.setBounds(getLastDragLocation(), 0, dividerSize, splitPane.getHeight());
            addHeavyweightDivider();
        }
    } else {
        setLastDragLocation(divider.getBounds().y);
        dividerSize = divider.getSize().height;
        if (!isContinuousLayout() && draggingHW) {
            nonContinuousLayoutDivider.setBounds(0, getLastDragLocation(), splitPane.getWidth(), dividerSize);
            addHeavyweightDivider();
        }
    }
}
Also used : LightweightPeer(java.awt.peer.LightweightPeer) ComponentPeer(java.awt.peer.ComponentPeer)

Example 17 with ComponentPeer

use of java.awt.peer.ComponentPeer in project jdk8u_jdk by JetBrains.

the class CGLVolatileSurfaceManager method initAcceleratedSurface.

/**
     * Create a pbuffer-based SurfaceData object (or init the backbuffer
     * of an existing window if this is a double buffered GraphicsConfig)
     */
protected SurfaceData initAcceleratedSurface() {
    SurfaceData sData = null;
    Component comp = vImg.getComponent();
    final ComponentPeer peer = (comp != null) ? comp.getPeer() : null;
    try {
        boolean createVSynced = false;
        boolean forceback = false;
        if (context instanceof Boolean) {
            forceback = ((Boolean) context).booleanValue();
            if (forceback && peer instanceof BackBufferCapsProvider) {
                BackBufferCapsProvider provider = (BackBufferCapsProvider) peer;
                BufferCapabilities caps = provider.getBackBufferCaps();
                if (caps instanceof ExtendedBufferCapabilities) {
                    ExtendedBufferCapabilities ebc = (ExtendedBufferCapabilities) caps;
                    if (ebc.getVSync() == VSYNC_ON && ebc.getFlipContents() == COPIED) {
                        createVSynced = true;
                        forceback = false;
                    }
                }
            }
        }
        if (forceback) {
        // peer must be non-null in this case
        // TODO: modify parameter to delegate
        //                sData = CGLSurfaceData.createData(peer, vImg, FLIP_BACKBUFFER);
        } else {
            CGLGraphicsConfig gc = (CGLGraphicsConfig) vImg.getGraphicsConfig();
            ColorModel cm = gc.getColorModel(vImg.getTransparency());
            int type = vImg.getForcedAccelSurfaceType();
            // use the forced type, otherwise choose one based on caps
            if (type == OGLSurfaceData.UNDEFINED) {
                type = gc.isCapPresent(CAPS_EXT_FBOBJECT) ? OGLSurfaceData.FBOBJECT : OGLSurfaceData.PBUFFER;
            }
            if (createVSynced) {
            // TODO: modify parameter to delegate
            //                  sData = CGLSurfaceData.createData(peer, vImg, type);
            } else {
                sData = CGLSurfaceData.createData(gc, vImg.getWidth(), vImg.getHeight(), cm, vImg, type);
            }
        }
    } catch (NullPointerException ex) {
        sData = null;
    } catch (OutOfMemoryError er) {
        sData = null;
    }
    return sData;
}
Also used : ComponentPeer(java.awt.peer.ComponentPeer) ExtendedBufferCapabilities(sun.java2d.pipe.hw.ExtendedBufferCapabilities) SurfaceData(sun.java2d.SurfaceData) ExtendedBufferCapabilities(sun.java2d.pipe.hw.ExtendedBufferCapabilities) BufferCapabilities(java.awt.BufferCapabilities) ColorModel(java.awt.image.ColorModel) BackBufferCapsProvider(sun.java2d.BackBufferCapsProvider) Component(java.awt.Component)

Example 18 with ComponentPeer

use of java.awt.peer.ComponentPeer in project jdk8u_jdk by JetBrains.

the class Component method updateCursorImmediately.

/**
     * Updates the cursor.  May not be invoked from the native
     * message pump.
     */
final void updateCursorImmediately() {
    if (peer instanceof LightweightPeer) {
        Container nativeContainer = getNativeContainer();
        if (nativeContainer == null)
            return;
        ComponentPeer cPeer = nativeContainer.getPeer();
        if (cPeer != null) {
            cPeer.updateCursorImmediately();
        }
    } else if (peer != null) {
        peer.updateCursorImmediately();
    }
}
Also used : LightweightPeer(java.awt.peer.LightweightPeer) ComponentPeer(java.awt.peer.ComponentPeer)

Example 19 with ComponentPeer

use of java.awt.peer.ComponentPeer in project jdk8u_jdk by JetBrains.

the class XComponentPeer method addTree.

private void addTree(Collection order, Set set, Container cont) {
    for (int i = 0; i < cont.getComponentCount(); i++) {
        Component comp = cont.getComponent(i);
        ComponentPeer peer = comp.getPeer();
        if (peer instanceof XComponentPeer) {
            Long window = Long.valueOf(((XComponentPeer) peer).getWindow());
            if (!set.contains(window)) {
                set.add(window);
                order.add(window);
            }
        } else if (comp instanceof Container) {
            // It is lightweight container, it might contain heavyweight components attached to this
            // peer
            addTree(order, set, (Container) comp);
        }
    }
}
Also used : Container(java.awt.Container) Component(java.awt.Component) ComponentPeer(java.awt.peer.ComponentPeer)

Example 20 with ComponentPeer

use of java.awt.peer.ComponentPeer in project jdk8u_jdk by JetBrains.

the class XWindowPeer method recursivelySetIcon.

public void recursivelySetIcon(java.util.List<IconInfo> icons) {
    dumpIcons(winAttr.icons);
    setIconHints(icons);
    Window target = (Window) this.target;
    Window[] children = target.getOwnedWindows();
    int cnt = children.length;
    for (int i = 0; i < cnt; i++) {
        ComponentPeer childPeer = children[i].getPeer();
        if (childPeer != null && childPeer instanceof XWindowPeer) {
            if (((XWindowPeer) childPeer).winAttr.iconsInherited) {
                ((XWindowPeer) childPeer).winAttr.icons = icons;
                ((XWindowPeer) childPeer).recursivelySetIcon(icons);
            }
        }
    }
}
Also used : ComponentPeer(java.awt.peer.ComponentPeer)

Aggregations

ComponentPeer (java.awt.peer.ComponentPeer)41 LightweightPeer (java.awt.peer.LightweightPeer)10 Component (java.awt.Component)5 Container (java.awt.Container)3 InputContext (java.awt.im.InputContext)2 ConstrainableGraphics (sun.awt.ConstrainableGraphics)2 Pointer (com.sun.jna.Pointer)1 BufferCapabilities (java.awt.BufferCapabilities)1 HeadlessException (java.awt.HeadlessException)1 AffineTransform (java.awt.geom.AffineTransform)1 ColorModel (java.awt.image.ColorModel)1 FramePeer (java.awt.peer.FramePeer)1 IOException (java.io.IOException)1 Method (java.lang.reflect.Method)1 TooManyListenersException (java.util.TooManyListenersException)1 AppContext (sun.awt.AppContext)1 CausedFocusEvent (sun.awt.CausedFocusEvent)1 SunToolkit (sun.awt.SunToolkit)1 WindowClosingListener (sun.awt.WindowClosingListener)1 SunDropTargetEvent (sun.awt.dnd.SunDropTargetEvent)1