Java 类java.awt.peer.ComponentPeer 实例源码
项目:OpenJSharp
文件:Component.java
/**
* @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);
}
}
}
项目:openjdk-jdk10
文件:XWindowPeer.java
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);
}
}
}
}
项目:jdk8u-jdk
文件:Container.java
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);
}
}
}
}
}
项目:jdk8u-jdk
文件:DropTarget.java
/**
* 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;
}
}
项目:openjdk-jdk10
文件:Component.java
/**
* 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);
}
}
项目:OpenJSharp
文件:Component.java
/**
* 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);
}
}
项目:jdk8u-jdk
文件:Component.java
/**
* 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);
}
}
项目:OpenJSharp
文件:Container.java
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);
}
}
}
}
}
项目:openjdk-jdk10
文件:XInputMethod.java
/**
* 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;
}
项目:OpenJSharp
文件:Container.java
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);
}
}
}
}
项目:OpenJSharp
文件:EventQueue.java
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;
}
项目:OpenJSharp
文件:CDropTarget.java
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.");
}
}
项目:openjdk-jdk10
文件:EventQueue.java
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;
}
项目:OpenJSharp
文件:XInputMethod.java
/**
* 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;
}
项目:OpenJSharp
文件:XComponentPeer.java
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);
}
}
}
项目:openjdk-jdk10
文件:Component.java
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;
}
}
项目:openjdk-jdk10
文件:Component.java
/**
* 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();
}
}
项目:jdk8u-jdk
文件:Container.java
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);
}
}
}
}
}
项目:jdk8u-jdk
文件:Component.java
/**
* @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);
}
}
}
项目:jdk8u-jdk
文件:WPageDialog.java
@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();
}
}
项目:jdk8u-jdk
文件:Component.java
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;
}
}
项目:openjdk-jdk10
文件:Component.java
/**
* @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;
}
项目:incubator-netbeans
文件:FakePeerSupport.java
public static void attachFakePeer(Component comp, ComponentPeer peer) {
try {
Field f = Component.class.getDeclaredField("peer"); // NOI18N
f.setAccessible(true);
f.set(comp, peer);
}
catch (Exception ex) {
org.openide.ErrorManager.getDefault().notify(
org.openide.ErrorManager.INFORMATIONAL, ex);
}
}
项目:jdk8u-jdk
文件:XDropTargetContextPeer.java
private boolean processSunDropTargetEvent(SunDropTargetEvent event) {
Object source = event.getSource();
if (source instanceof Component) {
ComponentPeer peer = ((Component)source).getPeer();
if (peer instanceof XEmbedCanvasPeer) {
XEmbedCanvasPeer xEmbedCanvasPeer = (XEmbedCanvasPeer)peer;
/* The native context is the pointer to the XClientMessageEvent
structure. */
long ctxt = getNativeDragContext();
if (logger.isLoggable(PlatformLogger.Level.FINER)) {
logger.finer(" processing " + event + " ctxt=" + ctxt +
" consumed=" + event.isConsumed());
}
/* If the event is not consumed, pass it to the
XEmbedCanvasPeer for processing. */
if (!event.isConsumed()) {
// NOTE: ctxt can be zero at this point.
if (xEmbedCanvasPeer.processXEmbedDnDEvent(ctxt,
event.getID())) {
event.consume();
return true;
}
}
}
}
return false;
}
项目:openjdk-jdk10
文件:Component.java
/**
* Creates an image from the specified image producer.
* @param producer the image producer
* @return the image produced
* @since 1.0
*/
public Image createImage(ImageProducer producer) {
ComponentPeer peer = this.peer;
if ((peer != null) && ! (peer instanceof LightweightPeer)) {
return peer.createImage(producer);
}
return getToolkit().createImage(producer);
}
项目:OpenJSharp
文件:DefaultFocusTraversalPolicy.java
/**
* Determines whether a Component is an acceptable choice as the new
* focus owner. The Component must be visible, displayable, and enabled
* to be accepted. If client code has explicitly set the focusability
* of the Component by either overriding
* <code>Component.isFocusTraversable()</code> or
* <code>Component.isFocusable()</code>, or by calling
* <code>Component.setFocusable()</code>, then the Component will be
* accepted if and only if it is focusable. If, however, the Component is
* relying on default focusability, then all Canvases, Labels, Panels,
* Scrollbars, ScrollPanes, Windows, and lightweight Components will be
* rejected.
*
* @param aComponent the Component whose fitness as a focus owner is to
* be tested
* @return <code>true</code> if aComponent meets the above requirements;
* <code>false</code> otherwise
*/
protected boolean accept(Component aComponent) {
if (!(aComponent.isVisible() && aComponent.isDisplayable() &&
aComponent.isEnabled()))
{
return false;
}
// Verify that the Component is recursively enabled. Disabling a
// heavyweight Container disables its children, whereas disabling
// a lightweight Container does not.
if (!(aComponent instanceof Window)) {
for (Container enableTest = aComponent.getParent();
enableTest != null;
enableTest = enableTest.getParent())
{
if (!(enableTest.isEnabled() || enableTest.isLightweight())) {
return false;
}
if (enableTest instanceof Window) {
break;
}
}
}
boolean focusable = aComponent.isFocusable();
if (aComponent.isFocusTraversableOverridden()) {
return focusable;
}
ComponentPeer peer = aComponent.getPeer();
return (peer != null && peer.isFocusable());
}
项目:openjdk-jdk10
文件:DisplayChangedTest.java
/**
* Test fails if it throws any exception.
*
* @throws Exception
*/
private void init() throws Exception {
if (!System.getProperty("os.name").startsWith("Windows")) {
System.out.println("This is Windows only test.");
return;
}
Frame frame = new Frame("AWT Frame");
frame.pack();
FramePeer frame_peer = AWTAccessor.getComponentAccessor()
.getPeer(frame);
Class comp_peer_class = Class.forName("sun.awt.windows.WComponentPeer");
Field hwnd_field = comp_peer_class.getDeclaredField("hwnd");
hwnd_field.setAccessible(true);
long hwnd = hwnd_field.getLong(frame_peer);
Class clazz = Class.forName("sun.awt.windows.WEmbeddedFrame");
Constructor constructor = clazz
.getConstructor(new Class[]{long.class});
Frame embedded_frame = (Frame) constructor
.newInstance(new Object[]{new Long(hwnd)});
frame.setVisible(true);
ComponentPeer peer = AWTAccessor.getComponentAccessor().getPeer(
embedded_frame);
Class peerClass = peer.getClass();
Method displayChangedM = peerClass.getMethod("displayChanged",
new Class[0]);
displayChangedM.invoke(peer, null);
embedded_frame.dispose();
frame.dispose();
}
项目:openjdk-jdk10
文件:XComponentPeer.java
/**
* @see java.awt.peer.ComponentPeer
*/
public void setEnabled(final boolean value) {
if (enableLog.isLoggable(PlatformLogger.Level.FINE)) {
enableLog.fine("{0}ing {1}", (value ? "Enabl" : "Disabl"), this);
}
boolean status = value;
// If any of our heavyweight ancestors are disable, we should be too
// See 6176875 for more information
final Container cp = SunToolkit.getNativeContainer(target);
final ComponentAccessor acc = AWTAccessor.getComponentAccessor();
if (cp != null) {
status &= acc.<XComponentPeer>getPeer(cp).isEnabled();
}
synchronized (getStateLock()) {
if (enabled == status) {
return;
}
enabled = status;
}
if (target instanceof Container) {
final Component[] list = ((Container) target).getComponents();
for (final Component child : list) {
final ComponentPeer p = acc.getPeer(child);
if (p != null) {
p.setEnabled(status && child.isEnabled());
}
}
}
repaint();
}
项目:openjdk-jdk10
文件:DefaultFocusTraversalPolicy.java
/**
* Determines whether a Component is an acceptable choice as the new
* focus owner. The Component must be visible, displayable, and enabled
* to be accepted. If client code has explicitly set the focusability
* of the Component by either overriding
* {@code Component.isFocusTraversable()} or
* {@code Component.isFocusable()}, or by calling
* {@code Component.setFocusable()}, then the Component will be
* accepted if and only if it is focusable. If, however, the Component is
* relying on default focusability, then all Canvases, Labels, Panels,
* Scrollbars, ScrollPanes, Windows, and lightweight Components will be
* rejected.
*
* @param aComponent the Component whose fitness as a focus owner is to
* be tested
* @return {@code true} if aComponent meets the above requirements;
* {@code false} otherwise
*/
protected boolean accept(Component aComponent) {
if (!(aComponent.isVisible() && aComponent.isDisplayable() &&
aComponent.isEnabled()))
{
return false;
}
// Verify that the Component is recursively enabled. Disabling a
// heavyweight Container disables its children, whereas disabling
// a lightweight Container does not.
if (!(aComponent instanceof Window)) {
for (Container enableTest = aComponent.getParent();
enableTest != null;
enableTest = enableTest.getParent())
{
if (!(enableTest.isEnabled() || enableTest.isLightweight())) {
return false;
}
if (enableTest instanceof Window) {
break;
}
}
}
boolean focusable = aComponent.isFocusable();
if (aComponent.isFocusTraversableOverridden()) {
return focusable;
}
ComponentPeer peer = aComponent.peer;
return (peer != null && peer.isFocusable());
}
项目:OpenJSharp
文件:Component.java
/**
* @deprecated As of JDK version 1.1,
* replaced by <code>setEnabled(boolean)</code>.
*/
@Deprecated
public void disable() {
if (enabled) {
KeyboardFocusManager.clearMostRecentFocusOwner(this);
synchronized (getTreeLock()) {
enabled = false;
// A disabled lw container is allowed to contain a focus owner.
if ((isFocusOwner() || (containsFocus() && !isLightweight())) &&
KeyboardFocusManager.isAutoFocusTransferEnabled())
{
// Don't clear the global focus owner. If transferFocus
// fails, we want the focus to stay on the disabled
// Component so that keyboard traversal, et. al. still
// makes sense to the user.
transferFocus(false);
}
ComponentPeer peer = this.peer;
if (peer != null) {
peer.setEnabled(false);
if (visible) {
updateCursorImmediately();
}
}
}
if (accessibleContext != null) {
accessibleContext.firePropertyChange(
AccessibleContext.ACCESSIBLE_STATE_PROPERTY,
null, AccessibleState.ENABLED);
}
}
}
项目:OpenJSharp
文件:Component.java
/**
* Sets the foreground color of this component.
* @param c the color to become this component's
* foreground color; if this parameter is <code>null</code>
* then this component will inherit
* the foreground color of its parent
* @see #getForeground
* @since JDK1.0
*/
public void setForeground(Color c) {
Color oldColor = foreground;
ComponentPeer peer = this.peer;
foreground = c;
if (peer != null) {
c = getForeground();
if (c != null) {
peer.setForeground(c);
}
}
// This is a bound property, so report the change to
// any registered listeners. (Cheap if there are none.)
firePropertyChange("foreground", oldColor, c);
}
项目:OpenJSharp
文件:Component.java
/**
* Sets the font of this component.
* <p>
* This method changes layout-related information, and therefore,
* invalidates the component hierarchy.
*
* @param f the font to become this component's font;
* if this parameter is <code>null</code> then this
* component will inherit the font of its parent
* @see #getFont
* @see #invalidate
* @since JDK1.0
* @beaninfo
* bound: true
*/
public void setFont(Font f) {
Font oldFont, newFont;
synchronized(getTreeLock()) {
oldFont = font;
newFont = font = f;
ComponentPeer peer = this.peer;
if (peer != null) {
f = getFont();
if (f != null) {
peer.setFont(f);
peerFont = f;
}
}
}
// This is a bound property, so report the change to
// any registered listeners. (Cheap if there are none.)
firePropertyChange("font", oldFont, newFont);
// This could change the preferred size of the Component.
// Fix for 6213660. Should compare old and new fonts and do not
// call invalidate() if they are equal.
if (f != oldFont && (oldFont == null ||
!oldFont.equals(f))) {
invalidateIfValid();
}
}
项目:OpenJSharp
文件:Component.java
/**
* Gets the instance of <code>ColorModel</code> used to display
* the component on the output device.
* @return the color model used by this component
* @see java.awt.image.ColorModel
* @see java.awt.peer.ComponentPeer#getColorModel()
* @see Toolkit#getColorModel()
* @since JDK1.0
*/
public ColorModel getColorModel() {
ComponentPeer peer = this.peer;
if ((peer != null) && ! (peer instanceof LightweightPeer)) {
return peer.getColorModel();
} else if (GraphicsEnvironment.isHeadless()) {
return ColorModel.getRGBdefault();
} // else
return getToolkit().getColorModel();
}
项目:OpenJSharp
文件:Component.java
/**
* @deprecated As of JDK version 1.1,
* replaced by <code>setLocation(int, int)</code>.
*/
@Deprecated
public void move(int x, int y) {
synchronized(getTreeLock()) {
setBoundsOp(ComponentPeer.SET_LOCATION);
setBounds(x, y, width, height);
}
}
项目:OpenJSharp
文件:Component.java
/**
* @deprecated As of JDK version 1.1,
* replaced by <code>setSize(int, int)</code>.
*/
@Deprecated
public void resize(int width, int height) {
synchronized(getTreeLock()) {
setBoundsOp(ComponentPeer.SET_SIZE);
setBounds(x, y, width, height);
}
}
项目:jdk8u-jdk
文件:Container.java
/**
* @deprecated As of JDK version 1.1,
* replaced by <code>getInsets()</code>.
*/
@Deprecated
public Insets insets() {
ComponentPeer peer = this.peer;
if (peer instanceof ContainerPeer) {
ContainerPeer cpeer = (ContainerPeer)peer;
return (Insets)cpeer.getInsets().clone();
}
return new Insets(0, 0, 0, 0);
}
项目:jdk8u-jdk
文件:LWComponentPeer.java
@Override
public void setZOrder(final ComponentPeer above) {
LWContainerPeer<?, ?> cp = getContainerPeer();
// Don't check containerPeer for null as it can only happen
// for windows, but this method is overridden in
// LWWindowPeer and doesn't call super()
cp.setChildPeerZOrder(this, (LWComponentPeer<?, ?>) above);
}
项目:OpenJSharp
文件:Component.java
/**
* Creates an image from the specified image producer.
* @param producer the image producer
* @return the image produced
* @since JDK1.0
*/
public Image createImage(ImageProducer producer) {
ComponentPeer peer = this.peer;
if ((peer != null) && ! (peer instanceof LightweightPeer)) {
return peer.createImage(producer);
}
return getToolkit().createImage(producer);
}
项目:jdk8u-jdk
文件:XComponentPeer.java
/**
* @see java.awt.peer.ComponentPeer
*/
public void setEnabled(final boolean value) {
if (enableLog.isLoggable(PlatformLogger.Level.FINE)) {
enableLog.fine("{0}ing {1}", (value ? "Enabl" : "Disabl"), this);
}
boolean status = value;
// If any of our heavyweight ancestors are disable, we should be too
// See 6176875 for more information
final Container cp = SunToolkit.getNativeContainer(target);
if (cp != null) {
status &= ((XComponentPeer) cp.getPeer()).isEnabled();
}
synchronized (getStateLock()) {
if (enabled == status) {
return;
}
enabled = status;
}
if (target instanceof Container) {
final Component[] list = ((Container) target).getComponents();
for (final Component child : list) {
final ComponentPeer p = child.getPeer();
if (p != null) {
p.setEnabled(status && child.isEnabled());
}
}
}
repaint();
}
项目:OpenJSharp
文件:Component.java
final ComponentPeer getHWPeerAboveMe() {
checkTreeLock();
Container cont = getContainer();
int indexAbove = getSiblingIndexAbove();
while (cont != null) {
for (int i = indexAbove; i > -1; i--) {
Component comp = cont.getComponent(i);
if (comp != null && comp.isDisplayable() && !comp.isLightweight()) {
return comp.getPeer();
}
}
// traversing the hierarchy up to the closest HW container;
// further traversing may return a component that is not actually
// a native sibling of this component and this kind of z-order
// request may not be allowed by the underlying system (6852051).
if (!cont.isLightweight()) {
break;
}
indexAbove = cont.getSiblingIndexAbove();
cont = cont.getContainer();
}
return null;
}