On Fri, 12 Dec 2025 01:26:40 GMT, Prasanta Sadhukhan <[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
> > > so it will fallback to table assigned foreground and background color
> >
> >
> > So how do people know that ? Reading the source and trial and error don't
> > count as ways to know.
>
> Its implementation detail, not sure why people need to know upfront... Are
> you thinking of user who will extend DefaultTableCellRenderer and provide its
> own implementation... In that case, do you want me to add some spec wording
> to DefaultTableCellRenderer?
@prrace Will this wordings be sufficient?
/**
* See readObject() and writeObject() in JComponent for more
* information about serialization in Swing.
+ * Setting foreground and background color to null will restore
+ * the foreground and background color to JTable cell's set
+ * foreground and background color
*/
@Serial
private void writeObject(ObjectOutputStream s) throws IOException {
Will it need a CSR? Please let me know soon for me to work on it..
-------------
PR Comment: https://git.openjdk.org/jdk/pull/28549#issuecomment-3654486494