Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closing window with currently opened date picker pop up yields exception #82

Closed
WiseEagleOwl opened this issue Aug 18, 2019 · 1 comment

Comments

@WiseEagleOwl
Copy link
Collaborator

Setup:

  • open JFrame window with a DatePicker on it.
  • the date picker popup (the one to visually select a date) is opened

Problem:

Closing the JFrame-window without closing the pop up first yields the following exception:

Exception in thread "AWT-EventQueue-0" java.awt.IllegalComponentStateException: component must be showing on the screen to determine its location
	at java.desktop/java.awt.Component.getLocationOnScreen_NoTreeLock(Component.java:2101)
	at java.desktop/java.awt.Component.getLocationOnScreen(Component.java:2075)
	at com.github.lgooddatepicker.zinternaltools.InternalUtilities.isMouseWithinComponent(InternalUtilities.java:417)
	at com.github.lgooddatepicker.zinternaltools.CustomPopup.windowLostFocus(CustomPopup.java:267)
	at java.desktop/java.awt.Window.processWindowFocusEvent(Window.java:2128)
	at java.desktop/java.awt.Window.processEvent(Window.java:2041)
	at java.desktop/java.awt.Component.dispatchEventImpl(Component.java:5008)
	at java.desktop/java.awt.Container.dispatchEventImpl(Container.java:2321)
	at java.desktop/java.awt.Window.dispatchEventImpl(Window.java:2772)
	at java.desktop/java.awt.Component.dispatchEvent(Component.java:4840)
	at java.desktop/java.awt.KeyboardFocusManager.redispatchEvent(KeyboardFocusManager.java:1950)
	at java.desktop/java.awt.DefaultKeyboardFocusManager.typeAheadAssertions(DefaultKeyboardFocusManager.java:1059)
	at java.desktop/java.awt.DefaultKeyboardFocusManager.dispatchEvent(DefaultKeyboardFocusManager.java:813)
	at java.desktop/java.awt.Component.dispatchEventImpl(Component.java:4889)
	at java.desktop/java.awt.Container.dispatchEventImpl(Container.java:2321)
	at java.desktop/java.awt.Window.dispatchEventImpl(Window.java:2772)
	at java.desktop/java.awt.Component.dispatchEvent(Component.java:4840)
	at [...]

Steps to Reproduce:

The exception can be reproduced with the following code:

DatePicker datePicker = new DatePicker();
JFrame testWin = new JFrame();
testWin.setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);
testWin.add(datePicker);
testWin.pack();
testWin.setVisible(true);
Thread.sleep(20);
datePicker.openPopup();
Thread.sleep(20);
testWin.dispatchEvent(new WindowEvent(testWin, WindowEvent.WINDOW_CLOSING));
WiseEagleOwl added a commit to WiseEagleOwl/LGoodDatePicker that referenced this issue Aug 18, 2019
WiseEagleOwl added a commit to WiseEagleOwl/LGoodDatePicker that referenced this issue Aug 18, 2019
@WiseEagleOwl
Copy link
Collaborator Author

This issue is solved with the merge of PR #83 🙂

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant