/* * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved. */ package helloworld; import javafx.application.Application; import javafx.scene.Scene; import javafx.scene.control.Button; import javafx.scene.layout.HBox; import javafx.scene.layout.StackPane; import javafx.stage.Stage; /** * * @author jcambon */ public class TestInlineCss extends Application { /** * @param args the command line arguments */ public static void main(String[] args) { Application.launch(args); } @Override public void start(Stage stage) { stage.setTitle("Test inline CSS"); StackPane root = new StackPane(); Scene scene = new Scene(root, 500, 250); String cssRules = "-fx-background-color: #ffffff14, #000000cc, #090a0c, linear-gradient(from 0.0% 0.0% to 0.0% 100.0%, #4a5661ff 0.0%, #1f2429ff 20.0%, #1f242aff 100.0%), linear-gradient(from 0.0% 0.0% to 0.0% 100.0%, #242a2eff 0.0%, #23282eff 100.0%), radial-gradient(focus-angle 0.0deg, focus-distance 0.0% , center 50.0% 0.0%, radius 100.0%, #878e94e5 0.0%, #ffffff00 100.0%);" + "-fx-background-insets: -3.0px -3.0px -4.0px -3.0px, -3.0px, 0.0px, 1.0px, 2.0px, 0.0px;" + "-fx-background-radius: 7.0px, 6.0px, 5.0px, 4.0px, 3.0px, 5.0px;" + "-fx-font-family: Arial;" + "-fx-font-size: 26.0px;" + "-fx-padding: 10.0px 20.0px 10.0px 20.0px;" + "-fx-text-fill: white;"; Button button1 = new Button(); button1.setText("Button 1"); button1.setStyle( ".button {" + cssRules + "}"); Button button2 = new Button(); button2.setText("Button 2"); button2.setStyle(cssRules); HBox hbox = new HBox(10); hbox.getChildren().addAll(button1, button2); root.getChildren().add(hbox); stage.setScene(scene); stage.show(); } }