mirror of
https://github.com/openjdk/jdk.git
synced 2026-01-28 03:58:21 +00:00
Invoker null check
This commit is contained in:
parent
c78ede2731
commit
91151bce29
@ -952,20 +952,21 @@ public class JPopupMenu extends JComponent implements Accessible,MenuElement {
|
||||
@BeanProperty(bound = false, expert = true, description
|
||||
= "The invoking component for the popup menu")
|
||||
public void setInvoker(Component invoker) {
|
||||
if (invoker != null) {
|
||||
Component oldInvoker = this.invoker;
|
||||
this.invoker = invoker;
|
||||
Component oldInvoker = this.invoker;
|
||||
this.invoker = invoker;
|
||||
|
||||
if ((oldInvoker != this.invoker) && (ui != null)) {
|
||||
ui.uninstallUI(this);
|
||||
if (oldInvoker != null) {
|
||||
oldInvoker.removePropertyChangeListener("ancestor", propListener);
|
||||
}
|
||||
invoker.addPropertyChangeListener("ancestor", propListener);
|
||||
ui.installUI(this);
|
||||
if ((oldInvoker != this.invoker) && (ui != null)) {
|
||||
ui.uninstallUI(this);
|
||||
if (oldInvoker != null) {
|
||||
oldInvoker.removePropertyChangeListener("ancestor", propListener);
|
||||
}
|
||||
invalidate();
|
||||
if (invoker != null) {
|
||||
invoker.addPropertyChangeListener("ancestor", propListener);
|
||||
}
|
||||
ui.installUI(this);
|
||||
}
|
||||
invalidate();
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@ -73,6 +73,7 @@ public class TestPopupInvoker {
|
||||
@Override
|
||||
public void popupMenuWillBecomeInvisible(PopupMenuEvent e) {
|
||||
popupHidden.countDown();
|
||||
popupMenu.setInvoker(null);
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -108,7 +109,6 @@ public class TestPopupInvoker {
|
||||
}
|
||||
} finally {
|
||||
SwingUtilities.invokeAndWait(() -> {
|
||||
popupMenu.setInvoker(null);
|
||||
if (frame != null) {
|
||||
frame.dispose();
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user