title: Java Swing Table size
body: <p>I'm having problems with JTables. I'm adding two tables to a panel, the tables are within a scrollpane, but when the app shows up, the tables always occupy more space than the number of rows, wasting my available space.</p>
  
  <p>I'm using groovy and swingbuilder to create the tables, here's the code:</p>
  
  <pre><code>scrollPane(){
      panel(layout: new MigLayout('wrap 3')) {
          //main title
          label(text: '&lt;html&gt;&lt;h1&gt;blah&lt;/h1&gt;&lt;/html&gt;',constraints: 'span 3') //title
  
          //tables
          def data = [[text: "ABC", combo: "abc"], [text: "DEF", combo: "def"]]
          def items = ['abc', 'def', 'ghi', 'jkl']
          def tableModelListener = { e -&gt; println "${e.firstRow} ${e.column} ${e.type}" } as TableModelListener
          scrollPane(constraints: 'span 3' ) {
              table(id: 'serviceTable') {
                  current.setFillsViewportHeight(false)
                  tableModel(list: data) {
                      current.addTableModelListener(tableModelListener)
                      propertyColumn(header: 'Text', propertyName: 'text')
                      propertyColumn(header: 'Combo', propertyName: 'combo')
                  }
              }
          }
          scrollPane(constraints: 'span 3' ) {
              table(id: 'groupsTable') {
                  tableModel(list: data) {
                      current.addTableModelListener(tableModelListener)
                      propertyColumn(header: 'Text2', propertyName: 'text')
                      propertyColumn(header: 'Combo2', propertyName: 'combo')
                  }
              }
          }
      }
  }
  </code></pre>
  
  <p>And here's the result:
  <a href="http://img517.imageshack.us/img517/6508/15181501ym9.jpg" rel="nofollow noreferrer">Image http://img517.imageshack.us/img517/6508/15181501ym9.jpg</a></p>
  
  <p>What I want is to make the table height according to the number of rows, and if possible I'd like the table to occupy full width also. I think my problem is related to the parent panels, but I cannot find the cause.</p>