我想添加一个包含textarea的scrollpane,但我不知道如何。所以我搜索了互联网并找到了一些例子,但没有他们帮我。 这是我的一些代码:
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
)
有人可以告诉我,如何在包含textareas的框架中添加滚动窗格?
提前致谢!
答案 0 :(得分:0)
只需将textArea
嵌入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)
}