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: Thanks, one more thing though...

Posted by udayk on May 26, 2001 at 8:07 AM

Set the policy in such a way that scrollbars
will appear always.
JScollPane scrollPane = new JScrollPane( table );
scrollPane.setHorizontalScrollBarPolicy(
JScrollPane.HORIZONTAL_SCROLLBAR_ALWAYS );
scrollPane.setVerticalScrollBarPolicy(
JScrollPane.VERTICAL_SCROLLBAR_ALWAYS );

-uday

> Thanks for your help. Do you know the code to ensure that the Scroll Bars will be visible at all times. I know that the ScrollPane can take in scrollbar policies as parameters but how exactly do you you implement these, if this is what I need.

> > 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