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);
}
}
}
}
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();
}
}
}
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;
}
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);
}
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);
}
}
}
Aggregations