我正在构建一个小对话框。 我从gradle构建脚本中使用Groovy。 该对话框由JList,JTextField和JButton组成。
列表中填充了文件名。有很多文件,所以我只想显示5个文件和一个scollbar通过列表。 我试图设置visibleRowCount但它仍然显示所有行。
new SwingBuilder().edt {
dialog(modal: true, // Otherwise the build will continue running before you closed the dialog
title: 'Enter program name',// Dialog title
alwaysOnTop: true, // pretty much what the name says
resizable: true, // Don't allow the user to resize the dialog
locationRelativeTo: null, // Place dialog in center of the screen
pack: true, // We need to pack the dialog (so it will take the size of it's children
show: true // Let's show it
) {
vbox { // Put everything below each other
label(text: "Program Name:")
list(id:"programName", items: progNames, visibleRowCount: 8)
label(text: "Start Rule Name:")
input = textField(id: 'ruleName', text: startRuleName)
button(defaultButton: true, text: 'OK', actionPerformed: {
testProgram = programName.selectedValuesList
startRuleName = ruleName.text
dispose() // Close dialog
})
}
}
}
如何限制可见行数?
答案 0 :(得分:2)
您只需要在@if(isset($user->city()->name))
{{$user->city()->name}}
@endif
节点中将list
的呼叫包裹起来,即:
scrollPane