Own-Programming-Language-Tu.../examples/forms/textfield.own

23 lines
585 B
Plaintext
Raw Permalink Normal View History

2016-07-29 19:29:01 +03:00
use "std"
use "forms"
textField = newTextField("Some text")
button = newButton("Click me")
button.onClick(def() {
println "TextField text: " + textField.getText()
textField.setText(textField.getText() + " Let's add new line")
})
window = newWindow("Text field example")
window.add(textField)
window.add(button, BorderLayout.SOUTH)
window.pack()
window.setLocationByPlatform()
window.setVisible()
textField.onAction(def() = echo("I am a TextField"))
textField.addKeyListener(def(type, event) {
println sprintf("%s %d %s",
type, event.keyCode, toChar(event.keyChar))
})