On Fri, 30 Jun 2023 19:36:43 GMT, Alexey Ivanov <aiva...@openjdk.org> wrote:
>> 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? > >> 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? > > Yes. > > I wonder if other components support this scenario. > 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. > You were right. At least in this case the current fix returns _full_rectangle_ dimension in a string form in stead of the text displayed in JComboBox. I think it is required to look for alternate fix, probably to get the displayed text from JComboBox and set it as an accessibleName. >How does JTable handle this kind of situation? Or JList? I case of JTable and JList, the accessible context is of type JLabel which returns the accessibleName in string format. ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/14497#discussion_r1250537863