• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

JTable Background in JDK 1.3.0

 
tmtully
Greenhorn
Posts: 4
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 18
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 6920
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
"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.
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic