Java – how to change the JTable background color to white by default?
•
Java
I have a JTable that I display in the JScrollPane Only JTable
Anyone can tell me which method to use to turn gray into white?
Solution
Rely on your code
> JTable#setFillsViewportHeight(true);
or
> JScrollPane#getViewport(). setBackground(JTable#getBackground());
Alternatively, you can fit jscrollpanes jviewport to the jtables view
> JTable#setPreferredScrollableViewportSize(JTable#getPreferredSize());
The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
二维码