On Fri, 10 Mar 2023 19:45:58 GMT, Damon Nguyen <[email protected]> wrote:
>> The issue is in Aqua L&F when an editable JComboBox with a border is used. >> In this case, when the comboBox is clicked for the drop-down menu to show, >> the drop-down menu appears at the wrong coordinates (blocking the text of >> the comboBox and making it unreadable). >> >> This seems to have been the case for a while and a similar issue appeared >> recently where an editable Aqua JComboBox also had wrong positioning due to >> having a border. >> >> This fix checks for a border and modifies the bounds to accommodate the >> border's size. Then the usual calculations for the comboBox popup works as >> expected. >> >> The new headful test creates an editable comboBox with a TitledBorder and >> with no border. Then, it automatically clicks the comboBox to open the >> popup, and clicks where the position of the first selectionItem should be. >> Finally, it checks if the selected item is correct. This is for all L&F's >> and the test passes on all OS's. > > Damon Nguyen has updated the pull request incrementally with one additional > commit since the last revision: > > Remove debug image test/jdk/javax/swing/JComboBox/EditableComboBoxPopupPos.java line 118: > 116: checkSelection(cb1Str, cb2Str); > 117: > 118: SwingUtilities.invokeAndWait(() -> frame.dispose()); `dispose()` will not be called if `checkSelection()` will throw an exception. So you should at least call `checkSelection()` after frame disposal. But as Alexey already said, more robust way is to call it from finally block, so we end up with a closed frame on any unexpected exception. ------------- PR: https://git.openjdk.org/jdk/pull/12750
