Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

How Do I make my JTable a fixed number of rows deep?

 
Rob Zidsen
Greenhorn
Posts: 16
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Well, no response so maybe I'll try to edit this to be clearer:
How do I specify a fixed number of rows I want displayed in my table? For example, say I want my table to be 10 rows deep at all times. If there are less than 10 total records, the table will still be 10 rows deep in height. If there are more than 10 rows, than JScrollPane will take care of the scrolling, but the height will still be only 10 rows deep.
[ September 03, 2003: Message edited by: Rob Zidsen ]
 
Mark Spritzler
ranger
Sheriff
Posts: 17278
6
IntelliJ IDE Mac Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Isn't that the default way that a JTable will work. Mine was like that. The only thing that you might not have is I put the Jtable into its own JPanel, within the entire GUI JFrame.
The JPanel uses BorderLayout. The JScrollPane is added to the JPanel, then the JTable added to the JScrollPane, with horizontal and vertical scrollbars on an as needed bases. See the Constants of JScrollPane for those values.
I might have had the rows of my JFrame with the GridBagLayout to be a constant height, and therefore would always be the same height.

Hope that helps.
Mark
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic