Java Forum

Ask Question   UnAnswered
Home » Forum » Java       RSS Feeds

help with scrolling JTables

  Asked By: Jodon    Date: May 28    Category: Java    Views: 631

I have been creating several tables to
display the records of a database. My problem is how
to make the table scroll horizontally. When i create
the tables and run them, what happens is, the column
widths are so thin that you can't read the content.
Java tries to make them fit inside the tableP(panel).
I want them to be set to 100 pixels wide and the other
columns hidden from view unless i scroll horizontally.

here is a flowchart on how it is made:
table(an instance of JTable) is found inside
tableScroll. tableScroll is found inside tableP.
tableP is then found inside the JFrame.

1. table >
2. tableScroll (this is the JScrollPane used so the
column headers will show.) >
3. tableP>
4. JFrame

Please help. I've been stuck here for quite a few
days now.



1 Answer Found

Answer #1    Answered By: Spiru Kelly     Answered On: May 28

try to change the scrollbar policy of your JScrollPane


Didn't find what you were looking for? Find more on help with scrolling JTables Or get search suggestion and latest updates.