Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
4
Task/Animation/Ceylon/animation-1.ceylon
Normal file
4
Task/Animation/Ceylon/animation-1.ceylon
Normal file
|
|
@ -0,0 +1,4 @@
|
|||
native("jvm")
|
||||
module animation "1.0.0" {
|
||||
import java.desktop "8";
|
||||
}
|
||||
43
Task/Animation/Ceylon/animation-2.ceylon
Normal file
43
Task/Animation/Ceylon/animation-2.ceylon
Normal file
|
|
@ -0,0 +1,43 @@
|
|||
import javax.swing {
|
||||
JFrame,
|
||||
JLabel,
|
||||
Timer
|
||||
}
|
||||
import java.awt.event {
|
||||
MouseAdapter,
|
||||
MouseEvent,
|
||||
ActionListener,
|
||||
ActionEvent
|
||||
}
|
||||
|
||||
shared void run() {
|
||||
value initialText = "Hello World! ";
|
||||
value label = JLabel(initialText);
|
||||
variable value forward = true;
|
||||
label.addMouseListener(object extends MouseAdapter() {
|
||||
mouseClicked(MouseEvent? mouseEvent) =>
|
||||
forward = !forward;
|
||||
});
|
||||
|
||||
Timer(1k, object satisfies ActionListener {
|
||||
shared actual void actionPerformed(ActionEvent? actionEvent) {
|
||||
String left;
|
||||
String right;
|
||||
if(forward) {
|
||||
left = label.text.last?.string else "?";
|
||||
right = "".join(label.text.exceptLast);
|
||||
} else {
|
||||
left = label.text.rest;
|
||||
right = label.text.first?.string else "?";
|
||||
}
|
||||
label.text = left + right;
|
||||
}
|
||||
}).start();
|
||||
|
||||
value frame = JFrame();
|
||||
frame.defaultCloseOperation = JFrame.\iEXIT_ON_CLOSE;
|
||||
frame.title = "Rosetta Code Animation Example";
|
||||
frame.add(label);
|
||||
frame.pack();
|
||||
frame.visible = true;
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue