title: SwingBuilder: scrollPane
body: <p>What's the proper way to set up a scroll pane using groovy's SwingBuilder? I'm using griffon and I'm having a hard time adding and removing components dynamically...</p>
  
  <p>Here's a snippet I've tried within SwingPad. It works ok, but the remove only take <strong>immediate</strong> effect if my scroll pane has scrollbars. If not, it takes 4-5 secs.</p>
  
  <p>Here's the snippet:</p>
  
  <pre><code>import java.awt.Dimension
  
  panel(id:'main') {
     panel {   
      button(name:'x', action: action(name:'add', closure:{p.add(label('new')); main.revalidate()}))
      button(action: action(name:'remove', closure:{p.removeAll();main.revalidate()}))
    }
  
      panel() {
        scrollPane(preferredSize: [200,200], constraints: context.CENTER) {
          panel(id:'p') {
            checkBoxList(listData: (1..20).collect([]){"Option $it"} as Object[])
  
        }
      }
    }
  }
  </code></pre>