src/java.desktop/share/classes/java/awt/Component.java

Print this page

        

*** 165,175 **** * aButton.addActionListener(new MyActionListener()); * } * } * </pre> * <p> ! * <b>Note</b>: For more information on the paint mechanisms utilitized * by AWT and Swing, including information on how to write the most * efficient painting code, see * <a href="http://www.oracle.com/technetwork/java/painting-140037.html">Painting in AWT and Swing</a>. * <p> * For details on the focus subsystem, see --- 165,175 ---- * aButton.addActionListener(new MyActionListener()); * } * } * </pre> * <p> ! * <b>Note</b>: For more information on the paint mechanisms utilized * by AWT and Swing, including information on how to write the most * efficient painting code, see * <a href="http://www.oracle.com/technetwork/java/painting-140037.html">Painting in AWT and Swing</a>. * <p> * For details on the focus subsystem, see
*** 353,363 **** */ boolean enabled = true; /** * True when the object is valid. An invalid object needs to ! * be layed out. This flag is set to false when the object * size is changed. * * @serial * @see #isValid * @see #validate --- 353,363 ---- */ boolean enabled = true; /** * True when the object is valid. An invalid object needs to ! * be laid out. This flag is set to false when the object * size is changed. * * @serial * @see #isValid * @see #validate
*** 416,426 **** private static final int FOCUS_TRAVERSABLE_UNKNOWN = 0; private static final int FOCUS_TRAVERSABLE_DEFAULT = 1; private static final int FOCUS_TRAVERSABLE_SET = 2; /** ! * Tracks whether this Component is relying on default focus travesability. * * @serial * @since 1.4 */ private int isFocusTraversableOverridden = FOCUS_TRAVERSABLE_UNKNOWN; --- 416,426 ---- private static final int FOCUS_TRAVERSABLE_UNKNOWN = 0; private static final int FOCUS_TRAVERSABLE_DEFAULT = 1; private static final int FOCUS_TRAVERSABLE_SET = 2; /** ! * Tracks whether this Component is relying on default focus traversability. * * @serial * @since 1.4 */ private int isFocusTraversableOverridden = FOCUS_TRAVERSABLE_UNKNOWN;
*** 659,669 **** /* * In some cases using "this" as an object to synchronize by * can lead to a deadlock if client code also uses synchronization * by a component object. For every such situation revealed we should * consider possibility of replacing "this" with the package private ! * objectLock object introduced below. So far there're 3 issues known: * - CR 6708322 (the getName/setName methods); * - CR 6608764 (the PropertyChangeListener machinery); * - CR 7108598 (the Container.paint/KeyboardFocusManager.clearMostRecentFocusOwner methods). * * Note: this field is considered final, though readObject() prohibits --- 659,669 ---- /* * In some cases using "this" as an object to synchronize by * can lead to a deadlock if client code also uses synchronization * by a component object. For every such situation revealed we should * consider possibility of replacing "this" with the package private ! * objectLock object introduced below. So far there are 3 issues known: * - CR 6708322 (the getName/setName methods); * - CR 6608764 (the PropertyChangeListener machinery); * - CR 7108598 (the Container.paint/KeyboardFocusManager.clearMostRecentFocusOwner methods). * * Note: this field is considered final, though readObject() prohibits
*** 781,791 **** */ OTHER } /* ! * The shape set with the applyCompoundShape() method. It uncludes the result * of the HW/LW mixing related shape computation. It may also include * the user-specified shape of the component. * The 'null' value means the component has normal shape (or has no shape at all) * and applyCompoundShape() will skip the following shape identical to normal. */ --- 781,792 ---- */ OTHER } /* ! * The shape set with the applyCompoundShape() method. It includes the ! * result * of the HW/LW mixing related shape computation. It may also include * the user-specified shape of the component. * The 'null' value means the component has normal shape (or has no shape at all) * and applyCompoundShape() will skip the following shape identical to normal. */
*** 806,816 **** */ private transient boolean isAddNotifyComplete = false; /** * Should only be used in subclass getBounds to check that part of bounds ! * is actualy changing */ int getBoundsOp() { assert Thread.holdsLock(getTreeLock()); return boundsOp; } --- 807,817 ---- */ private transient boolean isAddNotifyComplete = false; /** * Should only be used in subclass getBounds to check that part of bounds ! * is actually changing */ int getBoundsOp() { assert Thread.holdsLock(getTreeLock()); return boundsOp; }
*** 1689,1699 **** void clearCurrentFocusCycleRootOnHide() { /* do nothing */ } /* ! * Delete references from LightweithDispatcher of a heavyweight parent */ void clearLightweightDispatcherOnRemove(Component removedComponent) { if (parent != null) { parent.clearLightweightDispatcherOnRemove(removedComponent); } --- 1690,1700 ---- void clearCurrentFocusCycleRootOnHide() { /* do nothing */ } /* ! * Delete references from LightweightDispatcher of a heavyweight parent */ void clearLightweightDispatcherOnRemove(Component removedComponent) { if (parent != null) { parent.clearLightweightDispatcherOnRemove(removedComponent); }
*** 2335,2348 **** } boolean needNotify = true; mixOnReshaping(); if (peer != null) { ! // LightwightPeer is an empty stub so can skip peer.reshape if (!(peer instanceof LightweightPeer)) { reshapeNativePeer(x, y, width, height, getBoundsOp()); ! // Check peer actualy changed coordinates resized = (oldWidth != this.width) || (oldHeight != this.height); moved = (oldX != this.x) || (oldY != this.y); // fix for 5025858: do not send ComponentEvents for toplevel // windows here as it is done from peer or native code when // the window is really resized or moved, otherwise some --- 2336,2349 ---- } boolean needNotify = true; mixOnReshaping(); if (peer != null) { ! // LightweightPeer is an empty stub so can skip peer.reshape if (!(peer instanceof LightweightPeer)) { reshapeNativePeer(x, y, width, height, getBoundsOp()); ! // Check peer actually changed coordinates resized = (oldWidth != this.width) || (oldHeight != this.height); moved = (oldX != this.x) || (oldY != this.y); // fix for 5025858: do not send ComponentEvents for toplevel // windows here as it is done from peer or native code when // the window is really resized or moved, otherwise some
*** 5104,5114 **** ((AWTEvent)e).copyPrivateDataInto(newMWE); // When dispatching a wheel event to // ancestor, there is no need trying to find descendant // lightweights to dispatch event to. // If we dispatch the event to toplevel ancestor, ! // this could encolse the loop: 6480024. anc.dispatchEventToSelf(newMWE); if (newMWE.isConsumed()) { e.consume(); } return true; --- 5105,5115 ---- ((AWTEvent)e).copyPrivateDataInto(newMWE); // When dispatching a wheel event to // ancestor, there is no need trying to find descendant // lightweights to dispatch event to. // If we dispatch the event to toplevel ancestor, ! // this could enclose the loop: 6480024. anc.dispatchEventToSelf(newMWE); if (newMWE.isConsumed()) { e.consume(); } return true;
*** 6201,6211 **** /** * Indicates whether this class overrides coalesceEvents. * It is assumed that all classes that are loaded from the bootstrap * do not. ! * The boostrap class loader is assumed to be represented by null. * We do not check that the method really overrides * (it might be static, private or package private). */ private boolean checkCoalescing() { if (getClass().getClassLoader()==null) { --- 6202,6212 ---- /** * Indicates whether this class overrides coalesceEvents. * It is assumed that all classes that are loaded from the bootstrap * do not. ! * The bootstrap class loader is assumed to be represented by null. * We do not check that the method really overrides * (it might be static, private or package private). */ private boolean checkCoalescing() { if (getClass().getClassLoader()==null) {
*** 6249,6259 **** // First check superclass - we may not need to bother ourselves. Class<?> superclass = clazz.getSuperclass(); if (superclass == null) { // Only occurs on implementations that ! // do not use null to represent the bootsrap class loader. return false; } if (superclass.getClassLoader() != null) { Boolean value = coalesceMap.get(superclass); if (value == null) { --- 6250,6260 ---- // First check superclass - we may not need to bother ourselves. Class<?> superclass = clazz.getSuperclass(); if (superclass == null) { // Only occurs on implementations that ! // do not use null to represent the bootstrap class loader. return false; } if (superclass.getClassLoader() != null) { Boolean value = coalesceMap.get(superclass); if (value == null) {
*** 7759,7769 **** Component window = this; while ( (window != null) && !(window instanceof Window)) { if (!window.isVisible()) { if (focusLog.isLoggable(PlatformLogger.Level.FINEST)) { ! focusLog.finest("component is recurively invisible"); } return false; } window = window.parent; } --- 7760,7770 ---- Component window = this; while ( (window != null) && !(window instanceof Window)) { if (!window.isVisible()) { if (focusLog.isLoggable(PlatformLogger.Level.FINEST)) { ! focusLog.finest("component is recursively invisible"); } return false; } window = window.parent; }
*** 7863,7873 **** if (CausedFocusEvent.Cause.ACTIVATION == cause) { // we shouldn't call RequestFocusController in case we are // in activation. We do request focus on component which // has got temporary focus lost and then on component which is // most recent focus owner. But most recent focus owner can be ! // changed by requestFocsuXXX() call only, so this transfer has // been already approved. if (focusLog.isLoggable(PlatformLogger.Level.FINEST)) { focusLog.finest("cause is activation"); } return true; --- 7864,7874 ---- if (CausedFocusEvent.Cause.ACTIVATION == cause) { // we shouldn't call RequestFocusController in case we are // in activation. We do request focus on component which // has got temporary focus lost and then on component which is // most recent focus owner. But most recent focus owner can be ! // changed by requestFocusXXX() call only, so this transfer has // been already approved. if (focusLog.isLoggable(PlatformLogger.Level.FINEST)) { focusLog.finest("cause is activation"); } return true;
*** 8690,8700 **** */ private void doSwingSerialization() { Package swingPackage = Package.getPackage("javax.swing"); // For Swing serialization to correctly work Swing needs to // be notified before Component does it's serialization. This ! // hack accomodates this. // // Swing classes MUST be loaded by the bootstrap class loader, // otherwise we don't consider them. for (Class<?> klass = Component.this.getClass(); klass != null; klass = klass.getSuperclass()) { --- 8691,8701 ---- */ private void doSwingSerialization() { Package swingPackage = Package.getPackage("javax.swing"); // For Swing serialization to correctly work Swing needs to // be notified before Component does it's serialization. This ! // hack accommodates this. // // Swing classes MUST be loaded by the bootstrap class loader, // otherwise we don't consider them. for (Class<?> klass = Component.this.getClass(); klass != null; klass = klass.getSuperclass()) {
*** 9038,9048 **** } return false; } /** ! * Checks that this component meets the prerequesites to be focus owner: * - it is enabled, visible, focusable * - it's parents are all enabled and showing * - top-level window is focusable * - if focus cycle root has DefaultFocusTraversalPolicy then it also checks that this policy accepts * this component as focus owner --- 9039,9049 ---- } return false; } /** ! * Checks that this component meets the prerequisites to be focus owner: * - it is enabled, visible, focusable * - it's parents are all enabled and showing * - top-level window is focusable * - if focus cycle root has DefaultFocusTraversalPolicy then it also checks that this policy accepts * this component as focus owner
*** 9647,9657 **** } /** * Returns the size of this object in the form of a * <code>Dimension</code> object. The height field of the ! * <code>Dimension</code> object contains this objects's * height, and the width field of the <code>Dimension</code> * object contains this object's width. * * @return a <code>Dimension</code> object that indicates * the size of this component; <code>null</code> if --- 9648,9658 ---- } /** * Returns the size of this object in the form of a * <code>Dimension</code> object. The height field of the ! * <code>Dimension</code> object contains this object's * height, and the width field of the <code>Dimension</code> * object contains this object's width. * * @return a <code>Dimension</code> object that indicates * the size of this component; <code>null</code> if
*** 9831,9841 **** // ************************** MIXING CODE ******************************* /** * Check whether we can trust the current bounds of the component. * The return value of false indicates that the container of the ! * component is invalid, and therefore needs to be layed out, which would * probably mean changing the bounds of its children. * Null-layout of the container or absence of the container mean * the bounds of the component are final and can be trusted. */ final boolean areBoundsValid() { --- 9832,9842 ---- // ************************** MIXING CODE ******************************* /** * Check whether we can trust the current bounds of the component. * The return value of false indicates that the container of the ! * component is invalid, and therefore needs to be laid out, which would * probably mean changing the bounds of its children. * Null-layout of the container or absence of the container mean * the bounds of the component are final and can be trusted. */ final boolean areBoundsValid() {