Skip to content

Commit f6cca78

Browse files
author
Péter Veress
committed
init
0 parents  commit f6cca78

File tree

5 files changed

+74
-0
lines changed

5 files changed

+74
-0
lines changed

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
.idea
2+
out

src/sample/Controller.java

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
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+
}

src/sample/Main.java

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
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+
}

src/sample/sample.fxml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
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>

test.iml

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
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="&lt;PROJECT&gt;" />
13+
<option name="serverName" value="&lt;PROJECT&gt;" />
14+
</component>
15+
</module>

0 commit comments

Comments
 (0)