-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathCSSDemo.java
executable file
·43 lines (36 loc) · 1.18 KB
/
CSSDemo.java
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
import javafx.application.Application;
import javafx.geometry.Pos;
import javafx.scene.Scene;
import javafx.scene.control.Button;
import javafx.scene.layout.HBox;
import javafx.stage.Stage;
/**
* CSSのデモ
*
* CSSによって見栄えを定義する
*/
public class CSSDemo extends Application {
@Override
public void start(Stage stage) {
stage.setTitle("CSS Demo");
HBox container = new HBox(20);
container.setAlignment(Pos.CENTER);
Scene scene = new Scene(container, 400, 100);
// スタイルシートの設定
scene.getStylesheets().add("style.css");
// scene.getStylesheets().add("style1.css");
Button button1 = new Button("Button1");
Button button2 = new Button("Button2");
Button button3 = new Button("Button3");
// IDを設定する
button3.setId("button3");
container.getChildren().add(button1);
container.getChildren().add(button2);
container.getChildren().add(button3);
stage.setScene(scene);
stage.show();
}
public static void main(String[] args) {
Application.launch(null);
}
}