On Fri, 30 Jun 2023 07:46:22 GMT, Abhishek Kumar <[email protected]> wrote:

> 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.

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

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

Reply via email to