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:

RE: JScrollPanes and JTables - simple??

Posted by udayk on May 25, 2001 at 2:08 AM

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