1
它可能很容易解決,但因爲我真的是新來的斯卡拉我什至不知道我不知道什麼。EditDone不起作用 - 在斯卡拉揮杆
我必須編寫一個簡單的應用程序,在輸入文本字段被輸入後重寫輸入文本到輸出文本字段。
對象主要延伸SimpleSwingApplication {
def top = new MainFrame {
title = "Text Fields"
preferredSize = new Dimension(200, 90)
val inText = new TextField(10)
val outText = new TextField(10)
outText.editable = false
val inLabel = new Label("input")
val outLabel = new Label("output")
inText.listenTo(inText.keys)
inText.reactions += {
case EditDone(e) => println("aaaa") ; outText.text = e.text
}
contents = new FlowPanel(){
contents += inLabel
contents += inText
contents += outLabel
contents += outText
}
}
}
的EditDone事件不會火起來的某些原因。 KeyPressed事件應該結束,我知道我可以檢查它是否「輸入」鍵,但由於我的情況有特殊事件,我希望我可以使用它。
您應該接受您自己的答案以作進一步參考 –
好的,但由於StackOverflow策略,我必須等待2天。但我會記住它。 – TrN