forked from hacker85/JavaLessons
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCssStyleLesson.java
More file actions
45 lines (34 loc) · 1.25 KB
/
CssStyleLesson.java
File metadata and controls
45 lines (34 loc) · 1.25 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
package fx;
import javafx.application.Application;
import javafx.scene.Group;
import javafx.scene.Scene;
import javafx.scene.control.Button;
import javafx.scene.control.Label;
import javafx.stage.Stage;
/**
* Created by max on 3/2/17.
*/
public class CssStyleLesson extends Application {
public static void main(String[] args) {
Application.launch(args);
}
@Override
public void start(Stage primaryStage) throws Exception {
//AquaFx.style();
// Application.setUserAgentStylesheet(STYLESHEET_CASPIAN);
// Application.setUserAgentStylesheet(STYLESHEET_MODENA);
// Application.setUserAgentStylesheet(getClass().getResource("sample.css").toExternalForm());
Button button = new Button("press");
button.getStyleClass().add("test");
button.setStyle("-fx-background-color: blue");
Label label = new Label("test");
Group group = new Group();
Scene scene = new Scene(group, 400, 300);
scene.getStylesheets().add(getClass().getResource("sample.css").toExternalForm());
group.getChildren().add(button);
group.getChildren().add(label);
primaryStage.setTitle("Hello world!");
primaryStage.setScene(scene);
primaryStage.show();
}
}