The Artima Developer Community
Sponsored Link

Legacy Java Answers Forum
April 2001

Advertisement

Advertisement

This page contains an archived post to the Java Answers Forum made prior to February 25, 2002. If you wish to participate in discussions, please visit the new Artima Forums.

Message:

a question about the JTable and JScrollPane

Posted by wizardfan on June 29, 2001 at 5:33 AM

Hi!
Here I also ask a question about the JTable and JScrollPane.The background color of the table is white and JScrollPane's is gray.
How can I set it to white for the visual effect?I have use the code "scrollPane.setBackground(Color.white);" just after the new JScrollPane(table).


> Hi John,

> Adding a JTable to JScrollPane is very simple. No need to
> create another class for JTable and then add it to JScrollPane.
> JScollPane constructor takes the component as an argument,
> which it has to enclose in its pane. So code goes something
> like this..

> JTable table = new JTable();
> JScrollPane scrollPane = new JScrollPane( table );
> // then you can set various scrollbar policies based
> // on your requirement.

> Did I answer you ??
> -uday

> > I'm searching the web for code to implement a JTable and to add this to my JScrollPane in my class. Everywhere seems to say that there is a simple way to do this, but I can't figure it out. Do I HAVE to write a seperate class for the table and call this from my JScrollPane?
> > Also, how do I make sure my JSP always has scrollbars?

> > Any solutions, code, web-sites,... anything welcome.
> > Thanks.
> > JF.





Replies:

Sponsored Links



Google
  Web Artima.com   
Copyright © 1996-2009 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use - Advertise with Us