use of java.awt.peer.LightweightPeer in project jdk8u_jdk by JetBrains.
the class Component method getGraphics_NoClientCode.
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;
}
}
use of java.awt.peer.LightweightPeer in project jdk8u_jdk by JetBrains.
the class Component method show.
/**
* @deprecated As of JDK version 1.1,
* replaced by <code>setVisible(boolean)</code>.
*/
@Deprecated
public void show() {
if (!visible) {
synchronized (getTreeLock()) {
visible = true;
mixOnShowing();
ComponentPeer peer = this.peer;
if (peer != null) {
peer.setVisible(true);
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_SHOWN);
Toolkit.getEventQueue().postEvent(e);
}
}
Container parent = this.parent;
if (parent != null) {
parent.invalidate();
}
}
}
use of java.awt.peer.LightweightPeer 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.LightweightPeer 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();
}
}
}
use of java.awt.peer.LightweightPeer 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();
}
}
Aggregations