|
Advanced Examples to JavaFX |
|
import javafx.scene.geometry.Line;
import javafx.application.Frame;
import javafx.application.Stage;
import javafx.scene.paint.Color;
import javafx.scene.transform.Translate;
import javafx.scene.transform.Rotate;
import javafx.animation.Timeline;
import javafx.animation.KeyFrame;
import java.util.Calendar;
import java.lang.System;
import javafx.scene.image.ImageView;
import javafx.scene.image.Image;
var clock : Clock = Clock {};
clock.timer.start();
Frame {
stage : Stage {
content : clock
}
visible : true
title : “JavaFXClock”
width : 200
height : 230
closeAction : function() {
java.lang.System.exit( 0 );
}
}
public class Clock extends CustomNode {
attribute seconds : Number;
attribute minutes : Number;
attribute hours : Number;
public attribute timer : Timeline = Timeline {
repeatCount : Timeline.INDEFINITE
keyFrames :
KeyFrame {
time : 1s
action : function() {
var calendar : Calendar = Calendar.getInstance();
seconds = calendar.get( Calendar.SECOND );
minutes = calendar.get( Calendar.MINUTE );
hours = calendar.get( Calendar.HOUR_OF_DAY );
}
}
};
public function create(): Node {
return Group { |
|
Aug 2008 | Java Jazz Up |38 |
|
|
Pages:
1,
2,
3,
4,
5,
6,
7,
8,
9,
10,
11,
12,
13,
14,
15,
16,
17,
18,
19,
20,
21,
22,
23,
24,
25,
26,
27,
28,
29,
30,
31,
32,
33,
34,
35,
36,
37,
38,
39,
40,
41,
42,
43,
44,
45,
46,
47,
48,
49,
50,
51,
52,
53,
54,
55,
56,
57,
58,
59,
60,
61,
62,
63, Download PDF |
|
|