• 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 Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Swing problem with JTable

 
Ranch Hand
Posts: 38
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I'm creating a program that involves making a page of sorts. My "page" is a JPanel using BoxLayout (vertically), with a JLabel title, a JTableHeader and JTable full of data, and a JPanel at the bottom with some more info inside. The entire page panel is wrapped inside a JScrollPane and placed in my a JFrame. The entire thing is meant to look like almost like a website; you don't scroll the table itself, you scroll the whole page.

The problem is the table width. The table, by default sets its width to that of the panel it's in, but since the values don't nearly fill up all this space it looks astronomically wide. Every kind of setSize, etc. method that exists requires a height in addition to a width, but I don't want to set the height; the number of table rows is variable.

Can anybody help me figure out a simple way to set the width of my JTable so that it doesn't take over the pane?

Thanks all!!
 
Ranch Hand
Posts: 1325
Android Java Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Topic is more related to Swing / AWT / SWT / JFace Forum.
 
Tongue wrestling. It's not what you think. And here, take this tiny ad. You'll need it.
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic