mirror of
https://github.com/aNNiMON/Own-Programming-Language-Tutorial.git
synced 2024-09-20 08:44:20 +03:00
23 lines
585 B
Plaintext
23 lines
585 B
Plaintext
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))
|
|
}) |