File tree Expand file tree Collapse file tree 1 file changed +40
-0
lines changed
sources/net.sf.j2s.java.core/src/java/awt Expand file tree Collapse file tree 1 file changed +40
-0
lines changed Original file line number Diff line number Diff line change @@ -4360,6 +4360,26 @@ public synchronized FocusListener[] getFocusListeners() {
43604360 * @since 1.3
43614361 */
43624362 public void addHierarchyListener (HierarchyListener l ) {
4363+
4364+ if (l == null ) {
4365+ return ;
4366+ }
4367+ boolean notifyAncestors ;
4368+ synchronized (this ) {
4369+ notifyAncestors =
4370+ (hierarchyListener == null &&
4371+ (eventMask & AWTEvent .HIERARCHY_EVENT_MASK ) == 0 );
4372+ hierarchyListener = AWTEventMulticaster .add (hierarchyListener , l );
4373+ notifyAncestors = (notifyAncestors && hierarchyListener != null );
4374+ newEventsOnly = true ;
4375+ }
4376+ if (notifyAncestors ) {
4377+ synchronized (getTreeLock ()) {
4378+ adjustListeningChildrenOnParent (AWTEvent .HIERARCHY_EVENT_MASK ,
4379+ 1 );
4380+ }
4381+ }
4382+
43634383 }
43644384
43654385 /**
@@ -4381,6 +4401,26 @@ public void addHierarchyListener(HierarchyListener l) {
43814401 * @since 1.3
43824402 */
43834403 public void removeHierarchyListener (HierarchyListener l ) {
4404+
4405+ if (l == null ) {
4406+ return ;
4407+ }
4408+ boolean notifyAncestors ;
4409+ synchronized (this ) {
4410+ notifyAncestors =
4411+ (hierarchyListener != null &&
4412+ (eventMask & AWTEvent .HIERARCHY_EVENT_MASK ) == 0 );
4413+ hierarchyListener =
4414+ AWTEventMulticaster .remove (hierarchyListener , l );
4415+ notifyAncestors = (notifyAncestors && hierarchyListener == null );
4416+ }
4417+ if (notifyAncestors ) {
4418+ synchronized (getTreeLock ()) {
4419+ adjustListeningChildrenOnParent (AWTEvent .HIERARCHY_EVENT_MASK ,
4420+ -1 );
4421+ }
4422+ }
4423+
43844424 }
43854425
43864426 /**
You can’t perform that action at this time.
0 commit comments