On Fri, 8 Apr 2022 07:12:21 GMT, Manukumar V S <m...@openjdk.org> wrote:

>> Create a regression test for 
>> [JDK-4287690](https://bugs.openjdk.java.net/browse/JDK-4287690)
>> Issue description:
>> I want JComboBox to send an event just before the popup (drop down) list is 
>> displayed.
>> 
>> Fix:
>> This requires some additional API targeted for major release of the JDK 
>> (1.4).The PopupMenuEvent will from the JPopupMenu will be forwarded to the 
>> JComboBox. A client of the JComboBox can register itself as a 
>> PopupMenuListener to receive the notification.
>> So JComboBox should send drop down events when the drop down popup is 
>> visible as well as invisible. 
>> JComboBox.addPopupMenuListener(PopupMenuListener) can be used to register 
>> for pop up events.
>> 
>> Testing:
>> Tested using Mach5 in all platforms available(macos,linux and windows) and 
>> got all pass.
>
> Manukumar V S has updated the pull request incrementally with one additional 
> commit since the last revision:
> 
>   Review comment fixed: Removed unwanted directory

Looks good.

test/jdk/javax/swing/JComboBox/JComboBoxPopupMenuEventTest.java line 60:

> 58: 
> 59:     private static final String[] compStrs =
> 60:             {"apple", "citibank", "cisco", "cienna", "Oracle", "IBM"};

Probably, all company names should be capitalised?

test/jdk/javax/swing/JComboBox/JComboBoxPopupMenuEventTest.java line 134:

> 132:                 .invokeAndWait(() -> 
> loc.set(jComponent.getLocationOnScreen()));
> 133:         final Point location = loc.get();
> 134:         return location;

Could be simplified to
Suggestion:

        return loc.get();

test/jdk/javax/swing/JComboBox/JComboBoxPopupMenuEventTest.java line 166:

> 164:                 for (String comp : comps) {
> 165:                     comboBox.addItem(comp);
> 166:                 }

Just a suggestion: use `.forEach` and add items to the `comboBox` right in the 
stream without creating an intermediate list.

-------------

Marked as reviewed by aivanov (Reviewer).

PR: https://git.openjdk.java.net/jdk/pull/7906

Reply via email to