@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 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(); } }
/** Places content in a bordered pane with a title. */ class BorderedTitledPane extends StackPane { BorderedTitledPane(String titleString, Node content) { Label title = new Label(" " + titleString + " "); title.getStyleClass().add("bordered-titled-title"); StackPane.setAlignment(title, Pos.TOP_CENTER); StackPane contentPane = new StackPane(); content.getStyleClass().add("bordered-titled-content"); contentPane.getChildren().add(content); getStyleClass().add("bordered-titled-border"); getChildren().addAll(title, contentPane); } }
class CreateStage { private TextField textBox ; public CreateStage() { textBox = new TextField(); StackPane root = new StackPane(); root.getChildren().add(textBox); Scene scene = new Scene(root, 300, 250); Stage stage = new Stage(); stage.setTitle("Additional Stage"); stage.setScene(scene); stage.initModality(Modality.APPLICATION_MODAL); stage.showAndWait(); } public String getText() { return textBox.getText(); } }
final StackPane layout = new StackPane(); final Button skip = new Button("Skip"); final Button play = new Button("Pause"); Button invisiblePause = new Button("Pause"); invisiblePause.setVisible(false); play.prefHeightProperty().bind(invisiblePause.heightProperty()); layout.getChildren().addAll( invisiblePause, VBoxBuilder.create().spacing(10).alignment(Pos.CENTER).children(
StackPane pane = new StackPane(curvedColorPicker); pane.setPadding(new Insets(18)); hexField.textProperty().addListener((o, oldVal, newVal) -> updateColorFromUserInput(newVal)); StackPane tabContent = new StackPane(); tabContent.getChildren().add(rgbField); tabContent.setMinHeight(100); this.setPadding(new Insets(0)); dialog.setScene(customScene); final EventHandler<KeyEvent> keyEventListener = key -> { switch (key.getCode()) {
var Button = Java.type("javafx.scene.control.Button"); var StackPane = Java.type("javafx.scene.layout.StackPane"); var Scene = Java.type("javafx.scene.Scene"); $STAGE.title = "Hello World!"; var button = new Button(); button.text = "Say 'Hello World'"; button.onAction = function() print("Hello World!"); var root = new StackPane(); root.children.add(button); $STAGE.scene = new Scene(root, 300, 250); $STAGE.show();
import javafx.application.Application; import javafx.scene.Scene; import javafx.scene.image.Image; import javafx.scene.layout.StackPane; import javafx.stage.Stage; public class StackoverflowIcon extends Application { @Override public void start(Stage stage) { StackPane root = new StackPane(); // set icon stage.getIcons().add(new Image("/path/to/stackoverflow.jpg")); stage.setTitle("Wow!! Stackoverflow Icon"); stage.setScene(new Scene(root, 300, 250)); stage.show(); } public static void main(String[] args) { launch(args); } }
/** * Returns the current disclosure node set in this cell. */ public final Node getDisclosureNode() { if (disclosureNode.get() == null) { final StackPane disclosureNode = new StackPane(); disclosureNode.getStyleClass().setAll("tree-disclosure-node"); disclosureNode.setMouseTransparent(true); final StackPane disclosureNodeArrow = new StackPane(); disclosureNodeArrow.getStyleClass().setAll("arrow"); disclosureNode.getChildren().add(disclosureNodeArrow); setDisclosureNode(disclosureNode); } return disclosureNode.get(); }
SplitPane sp = new SplitPane(); final StackPane sp1 = new StackPane(); sp1.getChildren().add(new Button("Button One")); final StackPane sp2 = new StackPane(); sp2.getChildren().add(new Button("Button Two")); final StackPane sp3 = new StackPane(); sp3.getChildren().add(new Button("Button Three")); sp.getItems().addAll(sp1, sp2, sp3); sp.setDividerPositions(0.3f, 0.6f, 0.9f); SplitPane.setResizableWithParent(sp1, Boolean.FALSE); primaryStage.setScene(new Scene(sp, 300, 200)); primaryStage.setTitle("Welcome to JavaFX!"); primaryStage.sizeToScene(); primaryStage.show();
//still on Swing thread JFXPanel panel = new JFXPanel(); //now setting the scene to be embedded on the JFXPanel //this must be done inside the FX Application thread Platform.runLater(() -> { Group group = new Group(); group.getChildren.addAll(new Button("Cancel"), new Button("Save"), new Text("Status")); panel.setScene(new StackPane(group))}); //back on the Swing thread frame.add(panel);
import javafx.application.Application; import javafx.scene.Scene; import javafx.scene.image.Image; import javafx.scene.layout.StackPane; import javafx.stage.Stage; public class StackoverflowIcon extends Application { @Override public void start(Stage stage) { StackPane root = new StackPane(); // set icon stage.getIcons().add(new Image("/path/to/stackoverflow.jpg")); stage.setTitle("Wow!! Stackoverflow Icon"); stage.setScene(new Scene(root, 300, 250)); stage.show(); } public static void main(String[] args) { launch(args); } }
public JFXSliderSkin(JFXSlider slider) { super(slider); track = (StackPane) getSkinnable().lookup(".track"); thumb = (StackPane) getSkinnable().lookup(".thumb"); coloredTrack = new StackPane(); coloredTrack.getStyleClass().add("colored-track"); coloredTrack.setMouseTransparent(true); sliderValue = new Text(); sliderValue.getStyleClass().setAll("slider-value"); animatedThumb = new StackPane(); animatedThumb.getStyleClass().add("animated-thumb"); animatedThumb.getChildren().add(sliderValue); animatedThumb.setMouseTransparent(true); animatedThumb.setScaleX(0); animatedThumb.setScaleY(0); getChildren().add(getChildren().indexOf(thumb), coloredTrack); getChildren().add(getChildren().indexOf(thumb), animatedThumb); getChildren().add(0, mouseHandlerPane); registerChangeListener(slider.valueFactoryProperty(), "VALUE_FACTORY"); initListeners(); }
Button button = new Button("Hello"); Text text = new Text("hello"); HBox hbox = new HBox(); hbox.getChildren().addAll(button, text); // button will be left of text Image image = new Image("space.jpg",x,y, false, false); ImageView iv1 = new ImageView(); StackPane stackPane = new StackPane(); stackPane.getChildren().addAll(iv1, hbox); // hbox with button and text on top of image view HBox root = new HBox(); root.getChildren().add(stackPane); // etc
@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 void refreshBadge() { badge.getChildren().clear(); if (enabled) { Label labelControl = new Label(text.getValue()); StackPane badgePane = new StackPane(); badgePane.getStyleClass().add("badge-pane"); badgePane.getChildren().add(labelControl); //Adding a clip would avoid overlap but this does not work as intended //badgePane.setClip(clip); badge.getChildren().add(badgePane); StackPane.setAlignment(badge, getPosition()); FadeTransition ft = new FadeTransition(Duration.millis(666), badge); ft.setFromValue(0); ft.setToValue(1.0); ft.setCycleCount(1); ft.setAutoReverse(true); ft.play(); } }
image.setOpacity(0.3); StackPane layout = new StackPane(); layout.setStyle("-fx-background-color: mistyrose; -fx-padding: 10;"); layout.getChildren().setAll(image, label); stage.setTitle("Love Me Not"); stage.setScene(new Scene(layout)); stage.show();
calendarPlaceHolder.getChildren().add(contentHolder); calendarPlaceHolder.setClip(clip); StackPane contentPlaceHolder = new StackPane(calendarPlaceHolder); getChildren().add(contentPlaceHolder); if (is24HourView) { if (tmp == 0 || tmp > 12) { hoursContent.getChildren().get(0).setVisible(false); hoursContent.getChildren().get(1).setVisible(true); } else { hoursContent.getChildren().get(1).setVisible(false);
label.setStyle("-fx-text-fill: goldenrod; -fx-font: italic 20 \"serif\"; -fx-padding: 0 0 20 0; -fx-text-alignment: center"); StackPane glass = new StackPane(); StackPane.setAlignment(label, Pos.BOTTOM_CENTER); glass.getChildren().addAll(label); glass.setStyle("-fx-background-color: rgba(0, 100, 100, 0.5); -fx-background-radius: 10;"); glass.setMaxWidth(imageView.getFitWidth() - 40); glass.setMaxHeight(imageView.getFitHeight() - 40); final StackPane layout = new StackPane(); layout.getChildren().addAll(imageView, glass); layout.setStyle("-fx-background-color: silver; -fx-padding: 10;"); stage.setScene(new Scene(layout)); stage.show();