Refine search
public class Test extends Application { public static void main(String[] args) { launch(args); } @Override public void start(Stage primaryStage) { StackPane root = new StackPane(); root.setId("pane"); Scene scene = new Scene(root, 300, 250); scene.getStylesheets().addAll(this.getClass().getResource("style.css").toExternalForm()); primaryStage.setScene(scene); primaryStage.show(); } }
customScene.setUserAgentStylesheet(ownerScene.getUserAgentStylesheet()); customScene.getStylesheets().addAll(ownerScene.getStylesheets()); this.setPadding(new Insets(0)); dialog.setScene(customScene); final EventHandler<KeyEvent> keyEventListener = key -> { switch (key.getCode()) {
import javafx.stage.*; import javafx.application.*; import javafx.scene.control.*; import javafx.scene.*; public class Love extends Application { public void start(Stage stage) throws Exception { Scene scene = new Scene(new Label("hello, world")); scene.getStylesheets().add("love.css"); stage.setScene(scene); stage.show(); } }
@Override public void load(Scene scene) { scene.getStylesheets().add(getClass().getResource("/css/groovy-keywords.css").toExternalForm()); scene.getStylesheets().add(getClass().getResource("/css/searchbar.css").toExternalForm()); } }
public void start(Stage primaryStage) throws Exception { Scene scene = new Scene(new HBox()); primaryStage.setScene(scene); //add this 3 lines String css = Main.class.getResource("styles.css").toExternalForm(); scene.getStylesheets().clear(); scene.getStylesheets().add(css); ... }
@Override public void start(final Stage stage) throws Exception { StackPane pane = new StackPane(); JFXSpinner root = new JFXSpinner(); pane.getChildren().add(root); final Scene scene = new Scene(pane, 300, 300); scene.getStylesheets().add(MainDemo.class.getResource("/css/jfoenix-components.css").toExternalForm()); stage.setScene(scene); stage.setTitle("JFX Spinner Demo"); stage.show(); }
public static void addToScene(Scene scene) { scene.getStylesheets().add(IconFonts.class.getResource("fonts.css").toExternalForm()); }
import javafx.application.Application; import javafx.scene.Scene; import javafx.stage.Stage; public class Main extends Application { @Override public void start(Stage primaryStage) { Scene scene = new Scene(new XOUltimateBoard().getView()); scene.getStylesheets().add("ultimate-board.css"); primaryStage.setScene(scene); primaryStage.show(); } public static void main(String[] args) { launch(args); } }
@Override public void run() { Scene scene = SceneBuilder .create() .root( getRootNode() ).build(); if( stylesheet != null ) scene.getStylesheets().add( stylesheet ); stage.setScene( scene ); } }, 5 );
@Override public void start(Stage primaryStage) throws Exception { JFXToolbar jfxToolbar = new JFXToolbar(); jfxToolbar.setLeftItems(new Label("Left")); jfxToolbar.setRightItems(new Label("Right")); StackPane main = new StackPane(); main.getChildren().add(jfxToolbar); Scene scene = new Scene(main, 600, 400); scene.getStylesheets().add(ToolBarDemo.class.getResource("/css/jfoenix-components.css").toExternalForm()); primaryStage.setScene(scene); primaryStage.show(); }
public static void addToScene(Scene scene ){ scene.getStylesheets().add(CssUtil.class.getResource("/de/factoryfx/javafx/css/app.css").toExternalForm()); }
public void start(Stage primaryStage) { Scene scene = new Scene(new Group(new Rectangle(100, 100))); primaryStage.setScene(scene); scene.getStylesheets().add("/style.css"); primaryStage.show(); }
public DragFeedbackStage(Node n) { this.n = n; this.popupWindow = new Stage(); this.popupWindow.initStyle(StageStyle.TRANSPARENT); // this.popupWindow.initOwner(n.getScene().getWindow()); this.popupWindow.setUserData("findNodeExclude"); //$NON-NLS-1$ this.popupWindow.setAlwaysOnTop(true); StackPane root = new StackPane(); root.setBackground(new Background(new BackgroundFill(Color.TRANSPARENT, CornerRadii.EMPTY, Insets.EMPTY))); Scene value = new Scene(root); value.setFill(Color.TRANSPARENT); this.popupWindow.setScene(value); this.popupWindow.getScene().getStylesheets().setAll(n.getScene().getStylesheets()); this.popupWindow.getScene().setRoot(root); }
@Override public void start(Stage stage) { FlowPane main = new FlowPane(); main.setVgap(20); main.setHgap(20); CheckBox cb = new CheckBox("CheckBox"); JFXCheckBox jfxCheckBox = new JFXCheckBox("JFX CheckBox"); JFXCheckBox customJFXCheckBox = new JFXCheckBox("Custom JFX CheckBox"); customJFXCheckBox.getStyleClass().add("custom-jfx-check-box"); main.getChildren().add(cb); main.getChildren().add(jfxCheckBox); main.getChildren().add(customJFXCheckBox); StackPane pane = new StackPane(); pane.getChildren().add(main); StackPane.setMargin(main, new Insets(100)); pane.setStyle("-fx-background-color:WHITE"); final Scene scene = new Scene(pane, 600, 200); scene.getStylesheets().add(CheckBoxDemo.class.getResource("/css/jfoenix-components.css").toExternalForm()); stage.setTitle("JFX CheckBox Demo "); stage.setScene(scene); stage.setResizable(false); stage.show(); }
private Parent replaceSceneContent(String fxml) throws Exception { Parent page = (Parent) FXMLLoader.load( Main.class.getResource(fxml), null, new JavaFXBuilderFactory()); Scene scene = stage.getScene(); if (scene == null) { scene = new Scene(page, 1366, 720); scene.getStylesheets().add( Main.class.getResource( "../skinFolder/css/defaultSkin.css" ).toExternalForm()); stage.setScene(scene); } else { stage.getScene().setRoot(page); } stage.sizeToScene(); return page; }
import java.io.IOException; import javafx.application.Application; import javafx.fxml.FXMLLoader; import javafx.scene.Scene; import javafx.stage.Stage; public class HighlightOnHover extends Application { @Override public void start(Stage primaryStage) throws IOException { Scene scene = new Scene(FXMLLoader.load(getClass().getResource("HighlightOnHover.fxml"))); scene.getStylesheets().add("highlight-on-hover.css"); primaryStage.setScene(scene); primaryStage.show(); } public static void main(String[] args) { launch(args); } }
public DragFeedbackStage(Node n) { this.n = n; this.popupWindow = new Stage(); this.popupWindow.initStyle(StageStyle.TRANSPARENT); // this.popupWindow.initOwner(n.getScene().getWindow()); this.popupWindow.setUserData("findNodeExclude"); //$NON-NLS-1$ this.popupWindow.setAlwaysOnTop(true); StackPane root = new StackPane(); root.setBackground(new Background(new BackgroundFill(Color.TRANSPARENT, CornerRadii.EMPTY, Insets.EMPTY))); Scene value = new Scene(root); value.setFill(Color.TRANSPARENT); this.popupWindow.setScene(value); this.popupWindow.getScene().getStylesheets().setAll(n.getScene().getStylesheets()); this.popupWindow.getScene().setRoot(root); }
@Override public void start(Stage stage) { FlowPane main = new FlowPane(); main.setVgap(20); main.setHgap(20); main.getChildren().add(new Button("Java Button")); JFXButton jfoenixButton = new JFXButton("JFoenix Button"); main.getChildren().add(jfoenixButton); JFXButton button = new JFXButton("RAISED BUTTON"); button.getStyleClass().add("button-raised"); main.getChildren().add(button); JFXButton button1 = new JFXButton("DISABLED"); button1.setDisable(true); main.getChildren().add(button1); StackPane pane = new StackPane(); pane.getChildren().add(main); StackPane.setMargin(main, new Insets(100)); pane.setStyle("-fx-background-color:WHITE"); final Scene scene = new Scene(pane, 800, 200); scene.getStylesheets().add(ButtonDemo.class.getResource("/css/jfoenix-components.css").toExternalForm()); stage.setTitle("JFX Button Demo"); stage.setScene(scene); stage.show(); }
btn.setOnAction(new EventHandler<ActionEvent>() { @Override public void handle(ActionEvent event) { Parent root = null; try { root = (Pane) FXMLLoader.load(GameApp.class.getResource("/sample/buttonGrid.fxml")); Scene scene = new Scene(root); scene.getStylesheets().add(GameApp.class.getResource("/sample/Board.css").toExternalForm()); currentStage.setScene(scene); currentStage.setResizable(false); currentStage.show(); } catch (IOException e) { e.printStackTrace(); } } });
import java.io.IOException; import javafx.application.Application; import javafx.fxml.FXMLLoader; import javafx.scene.Scene; import javafx.stage.Stage; public class DynamicBorderColor extends Application { @Override public void start(Stage primaryStage) throws IOException { Scene scene = new Scene(FXMLLoader.load(getClass().getResource("DynamicBorderColor.fxml"))); scene.getStylesheets().add("my-stylesheet.css"); primaryStage.setScene(scene); primaryStage.show(); } public static void main(String[] args) { launch(args); } }