使用 groovy 的 swingbuilder 我想添加一个保存和退出按钮,但我不知道如何用 swingbuilder 关闭框架?由于我没有将框架分配给对象,因此我无法真正执行 frame.dispose() 或类似的操作。
swingBuilder.edt {
frame(title: 'Calc Spell Checker', size: [800, 600],
show: true, locationRelativeTo: null,
defaultCloseOperation: 1) {
borderLayout(vgap: 5)
panel(constraints: BorderLayout.CENTER,
border: compoundBorder([emptyBorder(10), titledBorder("Spell Checking pole ${projProp.location} in project ${projProp.projectName}")])) {
tableLayout {
tr {
td {
label 'Comments: '
}
td {
scrollPane(verticalScrollBarPolicy:JScrollPane.VERTICAL_SCROLLBAR_ALWAYS) {
list listData: projProp.comments, fixedCellWidth: 600, visibleRowCount: 6
}
}
}
tr {
td {
label 'Suggestions: '
}
}
tr {
td {
button text: 'Replace'
}
td {
button text: 'Ignore'
}
td {
button text: 'Close', actionPerformed: {
f.SetVisible(false)
}
}
}
}
}
}
}