Search in sources :

Example 11 with ComponentPeer

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

the class LightweightDispatcher method recursiveRelocateHeavyweightChildren.

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);
            }
        }
    }
}
Also used : ComponentPeer(java.awt.peer.ComponentPeer)

Example 12 with ComponentPeer

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

the class Component method hide.

/**
     * @deprecated As of JDK version 1.1,
     * replaced by <code>setVisible(boolean)</code>.
     */
@Deprecated
public void hide() {
    isPacked = false;
    if (visible) {
        clearCurrentFocusCycleRootOnHide();
        clearMostRecentFocusOwnerOnHide();
        synchronized (getTreeLock()) {
            visible = false;
            mixOnHiding(isLightweight());
            if (containsFocus() && KeyboardFocusManager.isAutoFocusTransferEnabled()) {
                transferFocus(true);
            }
            ComponentPeer peer = this.peer;
            if (peer != null) {
                peer.setVisible(false);
                createHierarchyEvents(HierarchyEvent.HIERARCHY_CHANGED, this, parent, HierarchyEvent.SHOWING_CHANGED, Toolkit.enabledOnToolkit(AWTEvent.HIERARCHY_EVENT_MASK));
                if (peer instanceof LightweightPeer) {
                    repaint();
                }
                updateCursorImmediately();
            }
            if (componentListener != null || (eventMask & AWTEvent.COMPONENT_EVENT_MASK) != 0 || Toolkit.enabledOnToolkit(AWTEvent.COMPONENT_EVENT_MASK)) {
                ComponentEvent e = new ComponentEvent(this, ComponentEvent.COMPONENT_HIDDEN);
                Toolkit.getEventQueue().postEvent(e);
            }
        }
        Container parent = this.parent;
        if (parent != null) {
            parent.invalidate();
        }
    }
}
Also used : LightweightPeer(java.awt.peer.LightweightPeer) ComponentPeer(java.awt.peer.ComponentPeer)

Example 13 with ComponentPeer

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

the class Component method postEvent.

/**
     * @deprecated As of JDK version 1.1,
     * replaced by dispatchEvent(AWTEvent).
     */
@Deprecated
public boolean postEvent(Event e) {
    ComponentPeer peer = this.peer;
    if (handleEvent(e)) {
        e.consume();
        return true;
    }
    Component parent = this.parent;
    int eventx = e.x;
    int eventy = e.y;
    if (parent != null) {
        e.translate(x, y);
        if (parent.postEvent(e)) {
            e.consume();
            return true;
        }
        // restore coords
        e.x = eventx;
        e.y = eventy;
    }
    return false;
}
Also used : ComponentPeer(java.awt.peer.ComponentPeer)

Example 14 with ComponentPeer

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

the class Component method setBackground.

/**
     * Sets the background color of this component.
     * <p>
     * The background color affects each component differently and the
     * parts of the component that are affected by the background color
     * may differ between operating systems.
     *
     * @param c the color to become this component's color;
     *          if this parameter is <code>null</code>, then this
     *          component will inherit the background color of its parent
     * @see #getBackground
     * @since JDK1.0
     * @beaninfo
     *       bound: true
     */
public void setBackground(Color c) {
    Color oldColor = background;
    ComponentPeer peer = this.peer;
    background = c;
    if (peer != null) {
        c = getBackground();
        if (c != null) {
            peer.setBackground(c);
        }
    }
    // This is a bound property, so report the change to
    // any registered listeners.  (Cheap if there are none.)
    firePropertyChange("background", oldColor, c);
}
Also used : ComponentPeer(java.awt.peer.ComponentPeer)

Example 15 with ComponentPeer

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

the class Component method enable.

/**
     * @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);
        }
    }
}
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