This week's book giveaway is in the Cloud/Virtualization forum.
We're giving away four copies of Learning OpenStack Networking: Build a solid foundation in virtual networking technologies for OpenStack-based clouds and have James Denton on-line!
See this thread for details.
Win a copy of Learning OpenStack Networking: Build a solid foundation in virtual networking technologies for OpenStack-based clouds this week in the Cloud/Virtualization forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Liutauras Vilda
  • Campbell Ritchie
  • Tim Cooke
  • Bear Bibeault
  • Devaka Cooray
Sheriffs:
  • Jeanne Boyarsky
  • Knute Snortum
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Ganesh Patekar
  • Stephan van Hulst
  • Pete Letkeman
  • Carey Brown
Bartenders:
  • Tim Holloway
  • Ron McLeod
  • Vijitha Kumara

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

 
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 ]
 
ranger
Sheriff
Posts: 17314
11
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
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!