On Wed, 10 Dec 2025 21:08:47 GMT, Phil Race <[email protected]> wrote:

> How/why does null restore the JTable-specified colors ? I don't see anything 
> about null in the spec. And what have people been doing the last 25 years if 
> serializing a JTable "broke" its rendering ?

Specifying null would cause `unselectedForeground` and `unselectedBackground` 
to be null
https://github.com/openjdk/jdk/blob/74dca863c2e61c13884c3454b8da7be125235970/src/java.desktop/share/classes/javax/swing/table/DefaultTableCellRenderer.java#L146-L148

 so it will fallback to table assigned foreground and background color 

https://github.com/openjdk/jdk/blob/74dca863c2e61c13884c3454b8da7be125235970/src/java.desktop/share/classes/javax/swing/table/DefaultTableCellRenderer.java#L215-L217
https://github.com/openjdk/jdk/blob/74dca863c2e61c13884c3454b8da7be125235970/src/java.desktop/share/classes/javax/swing/table/DefaultTableCellRenderer.java#L224-L226

Also, as is mentioned in the review 
https://github.com/openjdk/jdk/pull/28549#discussion_r2570711017 discerning 
gray with white can be difficult and not hugely different so maybe people have 
lived with it

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

PR Comment: https://git.openjdk.org/jdk/pull/28549#issuecomment-3640038716

Reply via email to