当前位置: 首页>>代码示例>>Java>>正文


Java ComponentPeer类代码示例

本文整理汇总了Java中java.awt.peer.ComponentPeer的典型用法代码示例。如果您正苦于以下问题:Java ComponentPeer类的具体用法?Java ComponentPeer怎么用?Java ComponentPeer使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


ComponentPeer类属于java.awt.peer包,在下文中一共展示了ComponentPeer类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: enable

import java.awt.peer.ComponentPeer; //导入依赖的package包/类
/**
 * @deprecated As of JDK version 1.1,
 * replaced by <code>setEnabled(boolean)</code>.
 */
@Deprecated
public void enable() {
    if (!enabled) {
        synchronized (getTreeLock()) {
            enabled = true;
            ComponentPeer peer = this.peer;
            if (peer != null) {
                peer.setEnabled(true);
                if (visible) {
                    updateCursorImmediately();
                }
            }
        }
        if (accessibleContext != null) {
            accessibleContext.firePropertyChange(
                                                 AccessibleContext.ACCESSIBLE_STATE_PROPERTY,
                                                 null, AccessibleState.ENABLED);
        }
    }
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:25,代码来源:Component.java

示例2: recursivelySetIcon

import java.awt.peer.ComponentPeer; //导入依赖的package包/类
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;
    final ComponentAccessor acc = AWTAccessor.getComponentAccessor();
    for (int i = 0; i < cnt; i++) {
        final ComponentPeer childPeer = acc.getPeer(children[i]);
        if (childPeer != null && childPeer instanceof XWindowPeer) {
            if (((XWindowPeer)childPeer).winAttr.iconsInherited) {
                ((XWindowPeer)childPeer).winAttr.icons = icons;
                ((XWindowPeer)childPeer).recursivelySetIcon(icons);
            }
        }
    }
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:18,代码来源:XWindowPeer.java

示例3: recursiveHideHeavyweightChildren

import java.awt.peer.ComponentPeer; //导入依赖的package包/类
private void recursiveHideHeavyweightChildren() {
    if (!hasHeavyweightDescendants()) {
        return;
    }
    for (int index = 0; index < getComponentCount(); index++) {
        Component comp = getComponent(index);
        if (comp.isLightweight()) {
            if  (comp instanceof Container) {
                ((Container)comp).recursiveHideHeavyweightChildren();
            }
        } else {
            if (comp.isVisible()) {
                ComponentPeer peer = comp.getPeer();
                if (peer != null) {
                    peer.setVisible(false);
                }
            }
        }
    }
}
 
开发者ID:lambdalab-mirror,项目名称:jdk8u-jdk,代码行数:21,代码来源:Container.java

示例4: addNotify

import java.awt.peer.ComponentPeer; //导入依赖的package包/类
/**
 * Notify the DropTarget that it has been associated with a Component
 *
 **********************************************************************
 * This method is usually called from java.awt.Component.addNotify() of
 * the Component associated with this DropTarget to notify the DropTarget
 * that a ComponentPeer has been associated with that Component.
 *
 * Calling this method, other than to notify this DropTarget of the
 * association of the ComponentPeer with the Component may result in
 * a malfunction of the DnD system.
 **********************************************************************
 * <P>
 * @param peer The Peer of the Component we are associated with!
 *
 */

public void addNotify(ComponentPeer peer) {
    if (peer == componentPeer) return;

    componentPeer = peer;

    for (Component c = component;
         c != null && peer instanceof LightweightPeer; c = c.getParent()) {
        peer = c.getPeer();
    }

    if (peer instanceof DropTargetPeer) {
        nativePeer = peer;
        ((DropTargetPeer)peer).addDropTarget(this);
    } else {
        nativePeer = null;
    }
}
 
开发者ID:lambdalab-mirror,项目名称:jdk8u-jdk,代码行数:35,代码来源:DropTarget.java

示例5: relocateComponent

import java.awt.peer.ComponentPeer; //导入依赖的package包/类
/**
 * Fix the location of the HW component in a LW container hierarchy.
 */
final void relocateComponent() {
    synchronized (getTreeLock()) {
        if (peer == null) {
            return;
        }
        int nativeX = x;
        int nativeY = y;
        for (Component cont = getContainer();
                cont != null && cont.isLightweight();
                cont = cont.getContainer())
        {
            nativeX += cont.x;
            nativeY += cont.y;
        }
        peer.setBounds(nativeX, nativeY, width, height,
                ComponentPeer.SET_LOCATION);
    }
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:22,代码来源:Component.java

示例6: recursiveShowHeavyweightChildren

import java.awt.peer.ComponentPeer; //导入依赖的package包/类
private void recursiveShowHeavyweightChildren() {
    if (!hasHeavyweightDescendants() || !isVisible()) {
        return;
    }
    for (int index = 0; index < getComponentCount(); index++) {
        Component comp = getComponent(index);
        if (comp.isLightweight()) {
            if  (comp instanceof Container) {
                ((Container)comp).recursiveShowHeavyweightChildren();
            }
        } else {
            if (comp.isVisible()) {
                ComponentPeer peer = comp.getPeer();
                if (peer != null) {
                    peer.setVisible(true);
                }
            }
        }
    }
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:21,代码来源:Container.java

示例7: getPeer

import java.awt.peer.ComponentPeer; //导入依赖的package包/类
/**
 * Returns peer of the given client component. If the given client component
 * doesn't have peer, peer of the native container of the client is returned.
 */
protected ComponentPeer getPeer(Component client) {
    XComponentPeer peer;

    if (log.isLoggable(PlatformLogger.Level.FINE)) {
        log.fine("Client is " + client);
    }
    peer = (XComponentPeer)XToolkit.targetToPeer(client);
    while (client != null && peer == null) {
        client = getParent(client);
        peer = (XComponentPeer)XToolkit.targetToPeer(client);
    }
    if (log.isLoggable(PlatformLogger.Level.FINE)) {
        log.fine("Peer is {0}, client is {1}", peer, client);
    }

    if (peer != null)
        return peer;

    return null;
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:25,代码来源:XInputMethod.java

示例8: recursiveRelocateHeavyweightChildren

import java.awt.peer.ComponentPeer; //导入依赖的package包/类
private void recursiveRelocateHeavyweightChildren(Point origin) {
    for (int index = 0; index < getComponentCount(); index++) {
        Component comp = getComponent(index);
        if (comp.isLightweight()) {
            if  (comp instanceof Container &&
                    ((Container)comp).hasHeavyweightDescendants())
            {
                final Point newOrigin = new Point(origin);
                newOrigin.translate(comp.getX(), comp.getY());
                ((Container)comp).recursiveRelocateHeavyweightChildren(newOrigin);
            }
        } else {
            ComponentPeer peer = comp.getPeer();
            if (peer != null) {
                peer.setBounds(origin.x + comp.getX(), origin.y + comp.getY(),
                        comp.getWidth(), comp.getHeight(),
                        ComponentPeer.SET_LOCATION);
            }
        }
    }
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:22,代码来源:Container.java

示例9: coalescePaintEvent

import java.awt.peer.ComponentPeer; //导入依赖的package包/类
private boolean coalescePaintEvent(PaintEvent e) {
    ComponentPeer sourcePeer = ((Component)e.getSource()).peer;
    if (sourcePeer != null) {
        sourcePeer.coalescePaintEvent(e);
    }
    EventQueueItem[] cache = ((Component)e.getSource()).eventCache;
    if (cache == null) {
        return false;
    }
    int index = eventToCacheIndex(e);

    if (index != -1 && cache[index] != null) {
        PaintEvent merged = mergePaintEvents(e, (PaintEvent)cache[index].event);
        if (merged != null) {
            cache[index].event = merged;
            return true;
        }
    }
    return false;
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:21,代码来源:EventQueue.java

示例10: CDropTarget

import java.awt.peer.ComponentPeer; //导入依赖的package包/类
private CDropTarget(DropTarget dropTarget, Component component, ComponentPeer peer) {
    super();

    fDropTarget = dropTarget;
    fComponent = component;
    fPeer = peer;

    long nativePeer = CPlatformWindow.getNativeViewPtr(((LWComponentPeer) peer).getPlatformWindow());
    if (nativePeer == 0L) return; // Unsupported for a window without a native view (plugin)

    // Create native dragging destination:
    fNativeDropTarget = this.createNativeDropTarget(dropTarget, component, peer, nativePeer);
    if (fNativeDropTarget == 0) {
        throw new IllegalStateException("CDropTarget.createNativeDropTarget() failed.");
    }
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:17,代码来源:CDropTarget.java

示例11: addTree

import java.awt.peer.ComponentPeer; //导入依赖的package包/类
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);
        }
    }
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:18,代码来源:XComponentPeer.java

示例12: getGraphics_NoClientCode

import java.awt.peer.ComponentPeer; //导入依赖的package包/类
final Graphics getGraphics_NoClientCode() {
    ComponentPeer peer = this.peer;
    if (peer instanceof LightweightPeer) {
        // This is for a lightweight component, need to
        // translate coordinate spaces and clip relative
        // to the parent.
        Container parent = this.parent;
        if (parent == null) return null;
        Graphics g = parent.getGraphics_NoClientCode();
        if (g == null) return null;
        if (g instanceof ConstrainableGraphics) {
            ((ConstrainableGraphics) g).constrain(x, y, width, height);
        } else {
            g.translate(x,y);
            g.setClip(0, 0, width, height);
        }
        g.setFont(getFont_NoClientCode());
        return g;
    } else {
        return (peer != null) ? peer.getGraphics() : null;
    }
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:23,代码来源:Component.java

示例13: updateCursorImmediately

import java.awt.peer.ComponentPeer; //导入依赖的package包/类
/**
 * 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.peer;

        if (cPeer != null) {
            cPeer.updateCursorImmediately();
        }
    } else if (peer != null) {
        peer.updateCursorImmediately();
    }
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:20,代码来源:Component.java

示例14: enable

import java.awt.peer.ComponentPeer; //导入依赖的package包/类
/**
 * @deprecated As of JDK version 1.1,
 * replaced by <code>setEnabled(boolean)</code>.
 */
@Deprecated
public void enable() {
    if (!enabled) {
        synchronized (getTreeLock()) {
            enabled = true;
            ComponentPeer peer = this.peer;
            if (peer != null) {
                peer.setEnabled(true);
                if (visible && !getRecursivelyVisibleBounds().isEmpty()) {
                    updateCursorImmediately();
                }
            }
        }
        if (accessibleContext != null) {
            accessibleContext.firePropertyChange(
                                                 AccessibleContext.ACCESSIBLE_STATE_PROPERTY,
                                                 null, AccessibleState.ENABLED);
        }
    }
}
 
开发者ID:lambdalab-mirror,项目名称:jdk8u-jdk,代码行数:25,代码来源:Component.java

示例15: addNotify

import java.awt.peer.ComponentPeer; //导入依赖的package包/类
@Override
@SuppressWarnings("deprecation")
public void addNotify() {
    synchronized(getTreeLock()) {
        Container parent = getParent();
        if (parent != null && parent.getPeer() == null) {
            parent.addNotify();
        }

        if (getPeer() == null) {
            ComponentPeer peer = ((WToolkit)Toolkit.getDefaultToolkit()).
                createWPageDialog(this);
            setPeer(peer);
        }
        super.addNotify();
    }
}
 
开发者ID:lambdalab-mirror,项目名称:jdk8u-jdk,代码行数:18,代码来源:WPageDialog.java


注:本文中的java.awt.peer.ComponentPeer类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。