RFR: 8283214: [macos] Screen magnifier does not show the magnified text for JcomboBox [v3]

Abhishek Kumar abhiscxk at openjdk.org
Fri Jun 30 11:18:56 UTC 2023


On Fri, 30 Jun 2023 10:38:01 GMT, Alexey Ivanov <aivanov at openjdk.org> wrote:

>> I tried with the `Integer` object and it works fine. Please suggest if anything else I can test.
>
>> I tried with the `Integer` object and it works fine. Please suggest if anything else I can test.
> 
> Obviously, it does.
> 
> What about a custom object which doesn't override `toString`? Although this shouldn't be a problem either.
> 
> What if `JComboBox` uses a non-standard renderer which takes a property from an object? Let's assume, `JComboBox` is populated with `Rectangle` objects, a custom renderer is set which displays the value of the `bottom` field in the combo box. Your code, if I understand it correctly, will default to _full rectangle_ rather than what's really displayed.
> 
> How does `JTable` handle this kind of situation? Or `JList`? Swing relies on renderers which makes it capable of displaying an arbitrary object (it uses `toString` by default, if I'm not mistaken), a renderer could provide a custom view of an object in a cell, in a list.

I need to check with custom renderer. 

If I understand correctly, with current fix the `getSelectedItem` method will return the `rectangle` object and then calling `toString` method will return rectangle's dimension instead of the displayed text in JComboBox and that may result incorrectly. Right?

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

PR Review Comment: https://git.openjdk.org/jdk/pull/14497#discussion_r1247750687



More information about the client-libs-dev mailing list