Search code examples
swinggroovyscrollswingbuilder

scroll around a image in groovy?


IM trying to scroll around a image in groovy but not work

IM using this code and appears a image static

How I could scroll with this code

panel(layout: new BorderLayout()) {
    scrollPane(size:[100,100],    
    verticalScrollBarPolicy:JScrollPane.VERTICAL_SCROLLBAR_ALWAYS) {
        panel(size:[200,100]) {
            label(icon: imageIcon(new URL("file:pokemon.png")))
        }
    }
}

Please help me.


Solution

  • Finally I solve with this

      scrollPane(id:'scroll',preferredSize: [200,200], constraints: context.CENTER) {
    
    
    
        panel(layout: new FlowLayout()) {
    
    
            label(icon: imageIcon(new URL('file:///path/pokemon.png')))
        }
    
    
          }