1

I want to add a scrollpane, which contains a textarea, but I don't know how. So I searched the internet and found some examples, but none of them helped me.

This is some of my code:

frame = sb.frame(title:"BPNM Builder", size:[600, 400],defaultCloseOperation:WindowConstants.EXIT_ON_CLOSE){

panel(id:'mainpanel',border:BorderFactory.createEmptyBorder(10,10,10,10)){
    gridBagLayout()
    
       
    label(
            text:"out:",
            constraints: gbc(gridx:0,gridy:0,fill:HORIZONTAL,insets:[0, 0, 323, 0])
            )

    textArea(
            id:'liste',"commands:\n" + ml.opList,preferredSize:new Dimension(200,180),
            constraints:gbc(gridx:1,gridy:0,gridwidth:REMAINDER,fill:VERTICAL,insets:[20, 300, 85, 0])
            ,editable:false
            )
            
    textArea(
            id:'outline',preferredSize:new Dimension(350,140),
            constraints:gbc(gridx:0,gridy:0,gridwidth:REMAINDER,fill:VERTICAL,insets:[20, 0, 85, 200])
            ,editable:false, lineWrap:true, wrapStyleWord:true
            )

Could somebody tell me, how I can add a scrollpane to my frame, containing textareas?

Thanks in advance!

Jason Aller
  • 3,541
  • 28
  • 38
  • 38
  • Not a Groovy programmer! But, call setViewportView for your scroll pane and pass text area. Which would probably be `viewportView`. – Branislav Lazic Feb 12 '15 at 16:53

1 Answers1

0

Just embed the textAreas in a scrollPane:

scrollPane(constraints:gbc(gridx:1, gridy:0, gridwidth:REMAINDER, fill:VERTICAL, insets:[20, 300, 85, 0])) {
    textArea(id:'liste', "commands:\n" + ml.opList,editable:false)
}
tim_yates
  • 167,322
  • 27
  • 342
  • 338