val textArea = new TextArea(text) {
addEventFilter(KeyEvent.ANY, (event: KeyEvent) => {
if (event.getEventType == KeyEvent.KEY_PRESSED && event.getCode == KeyCode.ENTER) {
event.consume()
if (event.isAltDown)
insertText(getCaretPosition,"\n")
}
})
}
在 javafx.scene.control.TextArea 中按 ALT+ENTER 时如何禁用声音?