import javafx.application.Application; import javafx.scene.Scene; import javafx.scene.control.TextField; import javafx.scene.layout.HBox; import javafx.stage.Stage; public class Main extends Application { public static void main(String[] args) { launch(args); } @Override public void start(final Stage stage) { HBox root = new HBox(); final Scene scene = new Scene(root); stage.setWidth(600); stage.setHeight(200); stage.setScene(scene); String cssPath = "/test.css"; scene.getStylesheets().addAll(cssPath); TextField tf = new TextField("Hello world"); tf.setStyle("-fx-background-color: pink;"); root.getChildren().addAll(tf); stage.setVisible(true); } }