File tree Expand file tree Collapse file tree 5 files changed +74
-0
lines changed Expand file tree Collapse file tree 5 files changed +74
-0
lines changed Original file line number Diff line number Diff line change
1
+ .idea
2
+ out
Original file line number Diff line number Diff line change
1
+ package sample ;
2
+
3
+ import javafx .animation .Animation ;
4
+ import javafx .animation .KeyFrame ;
5
+ import javafx .animation .Timeline ;
6
+ import javafx .fxml .FXML ;
7
+ import javafx .scene .control .Label ;
8
+ import javafx .util .Duration ;
9
+
10
+ import java .time .LocalDateTime ;
11
+
12
+ public class Controller {
13
+
14
+ @ FXML private Label label ;
15
+
16
+ @ FXML
17
+ public void initialize (){
18
+ label .setText ("próba" );
19
+ Timeline clock = new Timeline (new KeyFrame (Duration .ZERO , e -> {
20
+ label .setText (LocalDateTime .now ().getHour () + ":" + LocalDateTime .now ().getMinute () + ":" + LocalDateTime .now ().getSecond ());
21
+ }),
22
+ new KeyFrame (Duration .seconds (1 ))
23
+ );
24
+ clock .setCycleCount (Animation .INDEFINITE );
25
+ clock .play ();
26
+ }
27
+
28
+ }
Original file line number Diff line number Diff line change
1
+ package sample ;
2
+
3
+ import javafx .application .Application ;
4
+ import javafx .fxml .FXMLLoader ;
5
+ import javafx .scene .Parent ;
6
+ import javafx .scene .Scene ;
7
+ import javafx .stage .Stage ;
8
+
9
+ public class Main extends Application {
10
+
11
+ @ Override
12
+ public void start (Stage primaryStage ) throws Exception {
13
+ Parent root = FXMLLoader .load (getClass ().getResource ("sample.fxml" ));
14
+ primaryStage .setTitle ("Hello World" );
15
+ primaryStage .setScene (new Scene (root , 300 , 275 ));
16
+ primaryStage .show ();
17
+ }
18
+
19
+
20
+ public static void main (String [] args ) {
21
+ launch (args );
22
+ }
23
+ }
Original file line number Diff line number Diff line change
1
+ <?import javafx .scene.layout.GridPane?>
2
+
3
+ <?import javafx .scene.control.Label?>
4
+ <GridPane fx : controller =" sample.Controller" xmlns : fx =" http://javafx.com/fxml" alignment =" center" hgap =" 10" vgap =" 10" >
5
+ <Label fx : id =" label" GridPane.columnIndex=" 0" GridPane.rowIndex=" 1" />
6
+ </GridPane >
Original file line number Diff line number Diff line change
1
+ <?xml version =" 1.0" encoding =" UTF-8" ?>
2
+ <module type =" JAVA_MODULE" version =" 4" >
3
+ <component name =" NewModuleRootManager" inherit-compiler-output =" true" >
4
+ <exclude-output />
5
+ <content url =" file://$MODULE_DIR$" >
6
+ <sourceFolder url =" file://$MODULE_DIR$/src" isTestSource =" false" />
7
+ </content >
8
+ <orderEntry type =" inheritedJdk" />
9
+ <orderEntry type =" sourceFolder" forTests =" false" />
10
+ </component >
11
+ <component name =" sonarModuleSettings" >
12
+ <option name =" localAnalysisScripName" value =" < PROJECT> " />
13
+ <option name =" serverName" value =" < PROJECT> " />
14
+ </component >
15
+ </module >
You can’t perform that action at this time.
0 commit comments