質問編集履歴
2
書式の改善
title
CHANGED
File without changes
|
body
CHANGED
@@ -19,7 +19,7 @@
|
|
19
19
|
|
20
20
|
|
21
21
|
|
22
|
-
//javaFXを使うときはpublicをつけ
|
22
|
+
//javaFXを使うときはpublicをつける。
|
23
23
|
public class FortuneTeller2 extends Application {
|
24
24
|
public static void main(String[] args) {
|
25
25
|
launch(args);
|
1
書式の改善
title
CHANGED
File without changes
|
body
CHANGED
@@ -3,6 +3,7 @@
|
|
3
3
|
|
4
4
|
```
|
5
5
|
import java.util.Random;
|
6
|
+
|
6
7
|
import javafx.application.Application;
|
7
8
|
import javafx.event.ActionEvent;
|
8
9
|
import javafx.event.EventHandler;
|
@@ -49,7 +50,7 @@
|
|
49
50
|
|
50
51
|
//Buttonの作成
|
51
52
|
Button btnSend = new Button("占う");
|
52
|
-
Button
|
53
|
+
Button clear = new Button("リセット");
|
53
54
|
|
54
55
|
//Buttonが押された時の処理
|
55
56
|
btnSend.setOnAction(new EventHandler<ActionEvent>() {
|
@@ -94,17 +95,19 @@
|
|
94
95
|
}
|
95
96
|
}
|
96
97
|
});
|
97
|
-
|
98
|
+
clear.setOnAction(new EventHandler<ActionEvent>() {
|
98
99
|
public void handle(ActionEvent ae) {
|
99
|
-
|
100
|
+
message.setText(null);
|
101
|
+
rootNode.getChildren().add(null);
|
100
102
|
}
|
101
103
|
});
|
102
104
|
|
103
105
|
// sceneにテキストフィールド、ボタン、ラベルを設置
|
104
|
-
rootNode.getChildren().addAll(message, btnSend,
|
106
|
+
rootNode.getChildren().addAll(message, btnSend, clear, response);
|
105
107
|
myStage.show();
|
106
108
|
}
|
107
109
|
}
|
108
110
|
|
111
|
+
|
109
112
|
```
|
110
113
|
Eclipse使用
|