On Tue, 12 Jul 2022 22:56:37 GMT, Damon Nguyen <dngu...@openjdk.org> wrote:

>> When a JComboBox is editable, the button segment of the combo box is 
>> misaligned vertically and has a different height. This change fixes these 
>> issues and adds a manual test that checks the appearance of an editable and 
>> non-editable JComboBox.
>> 
>> One of the discussions revolving this issue is the native macOS appearance 
>> of editable JComboBoxes. After looking through native macOS apps, the only 
>> one found is in System Preferences > Date & Time. The problem here is that 
>> the native equivalent found here uses a blue button with a single down arrow 
>> as the button's symbol. The current swing implementation uses a white button 
>> with an up & down arrow symbol for the button. A JRS widget button that has 
>> this blue button with a single downward arrow exists but does not support 
>> text fields.
>> 
>> As such, I believe the best fix for this issue is to mainly fix the 
>> alignment and sizing issue. I looked through Apple's documentation for these 
>> UI elements but editable JComboBoxes aren't specifically listed anywhere. 
>> Similarly, there's barely any editable JComboBoxes used in native mac apps 
>> (only the date & time). So, I don't think it's a major issue if JComboBox 
>> does not exactly match the example found in Date & Time.
>
> Damon Nguyen has updated the pull request with a new target base due to a 
> merge or a rebase. The incremental webrev excludes the unrelated changes 
> brought in by the merge/rebase. The pull request contains six additional 
> commits since the last revision:
> 
>  - Updated method names for PassFailJFrame
>  - Merge branch 'openjdk:master' into 8054572/JComboBoxBorderAlignmentFix
>  - Removed commented lines. Added newlines.
>  - Updated test with PassFailJFrame
>  - Added test
>  - Adjusted height and coordinate for editable JComboBox

> > > Can you please show before and after fix image of the editable combobox? 
> > > It seems the border around the button makes it feel it's still not 
> > > aligned properly which gives the impression that the button is bigger 
> > > than textfield. Probably we can do away with the button border, if we 
> > > can, in case we cannot draw the border around the whole textfield+button.
> > > Also, I think if you try with different font size e.g. 
> > > `comboBox.setFont(new Font("Serif", Font.PLAIN, 30));`
> > > you will again see the editable combobox button height is not matching 
> > > textfield height whereas non editable one it is aligned..
> > 
> > 
> > Local test without the fix: <img alt="Local Test Without Fix" width="182" 
> > src="https://user-images.githubusercontent.com/96267980/178778291-805ed3e0-fed2-458d-9ae6-65ace37f8ef0.png";>
> > Local test with the fix: <img alt="Local Test With Alignment Fix" 
> > width="182" 
> > src="https://user-images.githubusercontent.com/96267980/178778425-5a8bf95a-014f-46dd-a018-29fd37b2fe39.png";>
> 
> <img alt="Screenshot 2022-07-14 at 10 41 39 AM" width="494" 
> src="https://user-images.githubusercontent.com/43534309/178904319-4e050697-d20c-4606-8434-954e1496c8a5.png";>
> 
> I am not getting the same uniform blue border around textfield and button as 
> can be seen in my screenshot with your test, which is seen in your image 
> (with fix), so I asked to remove that incomplete blue border.. I am testing 
> on BigSur 11.6..which os version is yours?

Discussed this with Prasanta over a meeting. I'm on Monterey 12.3.1. The border 
around the text field can be removed, but I can't seem to remove the button's 
border. I tried these but none removed the border (even though appearance 
changes for a standard JButton in testing):
- arrowButton.setBorder(javax.swing.BorderFactory.createEmptyBorder());
- arrowButton.setBorderPainted(false);
- arrowButton.setFocusPainted(false);

The appearance of this button in JComboBox seems to be set by the JRS, thus 
making a change to the button's border not possible. This concern will be 
compiled in a list alongside other questions regarding appearance of a 
JComboBox.

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

PR: https://git.openjdk.org/jdk/pull/9473

Reply via email to