Making JPanel "scrollable"
1 posts in topic
Flat View  Flat View

Posted By:   Anonymous
Posted On:   Wednesday, October 10, 2001 09:03 AM


I have an application that executes a database query via JDBC and places the results in a JTable inside of a JPanel

From javadoc I do not see a way to make the JTable scrollable; as it is usually too big to fit the screen, I'd like it to be.

Do I need to start from scratch to use a JScrollPane, or can I salvage my code and somehow, simply, make the JTable scrollable??

Re: Making JPanel "scrollable"

Posted By:   Jonathan_Feakes  
Posted On:   Monday, October 15, 2001 03:45 AM

JTable does not automatically provide a scrollable area, but it does implement the Scrollable interface so it can be scrolled via a JScrollPane.

To get a scrollable JTable:

1. create the component

2. add it to a JScrollPane

3. add the JScrollPane to the frame (or some container)

About | Sitemap | Contact