Re: How do I change background color of JTable, when setBackground doesn't work?
- From: Roland <roland@xxxxxxxxx>
- Date: Mon, 30 May 2005 13:05:50 +0200
On 30-5-2005 3:51, tomzam@xxxxxxxxx wrote:
I have a JTable that I am displaying in a JScrollpane. The JTable only displays a few rows of information in its grid. The space below the grid to the bottom of the JPanel, that contains the JScrollpane, (Which in turn contains the JTable) is colored solid gray. I'd like to change that color to white. I tried setting the JTable's background color to white, [using the method setBackground(Color,WHITE) ] but that didn't work.
Can anyone tell me which method to use to change that gray to white?
Set the background color of the scrollpane's viewport: scrollpane.getViewport().setBackground(Color.RED);
Second question.
I have a second JPanel that I put Buttons into. The buttons are gray, which is fine. But the buttons themselves are on a gray background.
How do I change that background to white?
I guess my general question is: which methods control the color between components?
setBackground(Color) setForeground(Color) setOpaque(boolean)
Some components are transparent (IIRC a JLabel) so setting background doesn't seem to have an effect, until you use setOpaque(true) on the component.
--
Regards,
Roland de Ruiter ___ ___ /__/ w_/ /__/ / \ /_/ / \ .
- References:
- Prev by Date: Re: How do I change background color of JTable, when setBackground doesn't work?
- Next by Date: Re: Swing text (XML) view control with autoformat?
- Previous by thread: Re: How do I change background color of JTable, when setBackground doesn't work?
- Next by thread: DnD vs mouseDragged
- Index(es):