File tree Expand file tree Collapse file tree 2 files changed +12
-11
lines changed
src/java.desktop/share/classes/javax/swing Expand file tree Collapse file tree 2 files changed +12
-11
lines changed Original file line number Diff line number Diff line change @@ -952,20 +952,21 @@ && isVisible()) {
952952 @ BeanProperty (bound = false , expert = true , description
953953 = "The invoking component for the popup menu" )
954954 public void setInvoker (Component invoker ) {
955- if (invoker != null ) {
956- Component oldInvoker = this .invoker ;
957- this .invoker = invoker ;
955+ Component oldInvoker = this .invoker ;
956+ this .invoker = invoker ;
958957
959- if ((oldInvoker != this .invoker ) && (ui != null )) {
960- ui .uninstallUI (this );
961- if (oldInvoker != null ) {
962- oldInvoker .removePropertyChangeListener ("ancestor" , propListener );
963- }
958+ if ((oldInvoker != this .invoker ) && (ui != null )) {
959+ ui .uninstallUI (this );
960+ if (oldInvoker != null ) {
961+ oldInvoker .removePropertyChangeListener ("ancestor" , propListener );
962+ }
963+ if (invoker != null ) {
964964 invoker .addPropertyChangeListener ("ancestor" , propListener );
965- ui .installUI (this );
966965 }
967- invalidate ( );
966+ ui . installUI ( this );
968967 }
968+ invalidate ();
969+
969970 }
970971
971972 /**
Original file line number Diff line number Diff line change @@ -73,6 +73,7 @@ public void popupMenuWillBecomeVisible(PopupMenuEvent e) {
7373 @ Override
7474 public void popupMenuWillBecomeInvisible (PopupMenuEvent e ) {
7575 popupHidden .countDown ();
76+ popupMenu .setInvoker (null );
7677 }
7778
7879 @ Override
@@ -108,7 +109,6 @@ public static void main(String[] args) throws Exception {
108109 }
109110 } finally {
110111 SwingUtilities .invokeAndWait (() -> {
111- popupMenu .setInvoker (null );
112112 if (frame != null ) {
113113 frame .dispose ();
114114 }
You can’t perform that action at this time.
0 commit comments