File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Swing / AWT / SWT and the fly likes JTable Background in JDK 1.3.0 Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "JTable Background in JDK 1.3.0" Watch "JTable Background in JDK 1.3.0" New topic
Author

JTable Background in JDK 1.3.0

tmtully
Greenhorn

Joined: Jun 01, 2001
Posts: 4
For the portions of the jtable that do NOT have rows in them, the background is by default grey, in JDK 1.3.0. However, in JDk 1.2.2 and earlier, you could set the background color, w/ setBackground(Color). This doesn't work in JDK 1.3.0. Does anybody know how to fix that?
Jagan Mohan Reddy
Greenhorn

Joined: May 15, 2001
Posts: 18
Hi,
I think you are using a scrollpane over the table.
The grey portion is not the table area but the view port area. so set the background for the view port.

the code for getting the background color is
table.setBackground(Color.red);
table.getViewport().setBackground(Color.red);

I think this solves ur problem.

Regards,
Jagan Mohan Reddy.
Frank Carver
Sheriff

Joined: Jan 07, 1999
Posts: 6920
"tmtully",
The Java Ranch has thousands of visitors every week, many with surprisingly similar names. To avoid confusion we have a naming convention, described at http://www.javaranch.com/name.jsp . We require names to have at least two words, separated by a space, and strongly recommend that you use your full real name. Please log in with a new name which meets the requirements.
Thanks.


Read about me at frankcarver.me ~ Raspberry Alpha Omega ~ Frank's Punchbarrel Blog
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: JTable Background in JDK 1.3.0
 
Similar Threads
JTable
Flashing a row in Jtable
JTable
JTable
JTable -background color