forked from txs72/JavaTutorial
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathFlashText.java
More file actions
executable file
·91 lines (89 loc) · 3.14 KB
/
FlashText.java
File metadata and controls
executable file
·91 lines (89 loc) · 3.14 KB
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
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
/* */ package ch32;
/* */ import javafx.application.Application;
/* */ import javafx.application.Platform;
/* */ import javafx.scene.Parent;
/* */ import javafx.scene.Scene;
/* */ import javafx.scene.control.Label;
/* */ import javafx.scene.layout.StackPane;
/* */ import javafx.stage.Stage;
/* */
/* */ public class FlashText extends Application {
/* 11 */ private String text = "";
/* */ class inner {}
/* */
/* */ class inner2 {}
/* */
/* */ public void start(Stage primaryStage) {
/* 17 */ StackPane pane = new StackPane();
/* 18 */ final Label lblText = new Label("Programming is fun");
/* 19 */ pane.getChildren().add(lblText);
/* */
/* 21 */ (new Thread(new Runnable()
/* */ {
/* */ public void run() {
/* */ try {
/* */ while (true) {
/* 26 */ if (lblText.getText().trim().length() == 0) {
/* 27 */ FlashText.this.text = "Welcome";
/* */ } else {
/* 29 */ FlashText.this.text = "";
/* */ }
/* 31 */ Platform.runLater(new Runnable()
/* */ {
/* */ public void run() {
/* 34 */ lblText.setText(FlashText.this.text);
/* */ }
/* */ });
/* */
/* 38 */ Thread.sleep(200L);
/* */ }
/* */
/* 41 */ } catch (InterruptedException interruptedException) {
/* */ return;
/* */ } }
/* 44 */ })).start();
/* */
/* 46 */ (new Thread(new Runnable()
/* */ {
/* */ public void run() {
/* */ try {
/* */ while (true) {
/* 51 */ if (lblText.getText().trim().length() == 0) {
/* 52 */ FlashText.this.text = "Welcome";
/* */ } else {
/* 54 */ FlashText.this.text = "";
/* */ }
/* 56 */ Platform.runLater(new Runnable()
/* */ {
/* */ public void run() {
/* 59 */ lblText.setText(FlashText.this.text);
/* */ }
/* */ });
/* */
/* 63 */ Thread.sleep(200L);
/* */ }
/* */
/* 66 */ } catch (InterruptedException interruptedException) {
/* */ return;
/* */ } }
/* 69 */ })).start();
/* */
/* */
/* 72 */ Scene scene = new Scene((Parent)pane, 200.0D, 50.0D);
/* 73 */ primaryStage.setTitle("FlashText");
/* 74 */ primaryStage.setScene(scene);
/* 75 */ primaryStage.show();
/* */ }
/* */
/* */
/* */
/* */
/* */
/* */ public static void main(String[] args) {
/* 83 */ launch(args);
/* */ }
/* */ }
/* Location: /Volumes/TXS.128G/hope useful/practice/2020.jar!/ch32/FlashText.class
* Java compiler version: 8 (52.0)
* JD-Core Version: 1.1.3
*/