controls.setPadding(new Insets(10)); controls.setAlignment(Pos.CENTER);
@Override public void start(Stage primaryStage) { final ToggleGroup group = new ToggleGroup(); JFXRadioButton javaRadio = new JFXRadioButton("JavaFX"); javaRadio.setPadding(new Insets(10)); javaRadio.setToggleGroup(group); JFXRadioButton jfxRadio = new JFXRadioButton("JFoenix"); jfxRadio.setPadding(new Insets(10)); jfxRadio.setToggleGroup(group); VBox vbox = new VBox(); vbox.getChildren().add(javaRadio); vbox.getChildren().add(jfxRadio); vbox.setSpacing(10); HBox hbox = new HBox(); hbox.getChildren().add(vbox); hbox.setSpacing(50); hbox.setPadding(new Insets(40, 10, 10, 120)); Scene scene = new Scene(hbox); primaryStage.setScene(scene); primaryStage.setWidth(500); primaryStage.setHeight(400); primaryStage.setTitle("JFX RadioButton Demo "); scene.getStylesheets() .add(RadioButtonDemo.class.getResource("/css/jfoenix-components.css").toExternalForm()); primaryStage.show(); }
Insets.EMPTY))); buttonsContainer.setPadding(new Insets(4)); buttonsContainer.setAlignment(Pos.CENTER_RIGHT);
new ImageView(pepsi) ); layout.setPadding(new Insets(10)); stage.setScene(new Scene(layout)); stage.show();
hBox.setPadding(new Insets(5, 5, 5, 5)); hBox.getChildren().add(lblTool);
public void setBackgroundImage(HBox group, String ebene) { ObservableList<String> styleClass = group.getStyleClass(); styleClass.setAll("hbox-group", ebene); } public SubScene buildFieldBackground(Scene scene){ PerspectiveCamera subSceneFieldCamera = new PerspectiveCamera(false); scene.setCamera(subSceneFieldCamera); HBox subSceneGroup2 = new HBox(); subSceneGroup2.getStylesheets().add(getClass().getResource("subscene.css").toExternalForm()); setBackgroundImage(subSceneGroup2, currentEbene); subSceneGroup2.setPadding(new Insets(0, 0, 0, 0)); SubScene subScene2 = new SubScene(subSceneGroup2, 1024, 768); subScene2.setLayoutX(100); subScene2.setLayoutY(100); return subScene2; }
HBox pane = new HBox(); Button buttonOK = new Button("OK"); Button buttonCancel = new Button("Cancel"); /************************************************/ pane.setMargin(buttonOK, new Insets(0, 10, 0, 0)); //This is where you should be looking at. /************************************************/ pane.setPadding(new Insets(25)); pane.getChildren().addAll(buttonOK, buttonCancel); Scene scene = new Scene(pane); primaryStage.setTitle("Stage Title"); primaryStage.setScene(scene); primaryStage.show();
public HBox addHBox(URL url) { HBox hbox = new HBox(); hbox.setPadding(new Insets(15, 12, 15, 12)); hbox.setSpacing(10); hbox.setStyle("-fx-background-color: #336699;"); hbox.setAlignment(Pos.TOP_CENTER); Image photo = new Image(url, 300, 300, false, false); ImageView myView = new ImageView(photo); hbox.getChildren().add(myView); return hbox; }
public void start(Stage primaryStage) { HBox hbox = new HBox(10); TextField field = new TextField(); HBox.setHgrow(field, Priority.ALWAYS); hbox.setAlignment(Pos.BASELINE_LEFT); hbox.getChildren().addAll( new Label("Search:"), field, new Button("Go") ); hbox.setPadding(new Insets(10)); Scene scene = new Scene(hbox, 600, 250, Color.WHITE); primaryStage.setScene(scene); primaryStage.show(); }
/** * Create the dialog content * <p> * Subclasses should normally override {@link #createDialogArea()} * </p> * * @return the content */ protected Parent createContents() { BorderPane p = new BorderPane(); p.getStyleClass().add(getClass().getSimpleName()); HBox box = new HBox(); box.setPadding(getContentInset()); Node content = createDialogArea(); HBox.setHgrow(content, Priority.ALWAYS); box.getChildren().add(content); p.setCenter(box); p.setBottom(createButtonBar()); return p; }
/** * Private constructor. Invoked from within this class. * @param parent */ private JFXOptionStage(Stage parent) { super(); initModality(Modality.WINDOW_MODAL); initOwner(parent); initStyle(StageStyle.UTILITY); root = new VBox(SPACING); root.getStyleClass().add("vbox"); content = new HBox(SPACING); content.setPadding(new Insets(5, 5, 5, 5)); content.setAlignment(Pos.CENTER); buttonBar = new HBox(SPACING); buttonBar.setPadding(new Insets(3, 3, 5, 3)); buttonBar.setAlignment(Pos.CENTER); }
/** * @return the button bar */ protected Node createButtonBar() { HBox b = new HBox(10); b.setPadding(new Insets(10)); Region spacer = new Region(); b.getChildren().add(spacer); HBox.setHgrow(spacer, Priority.ALWAYS); this.buttons = createButtonsForBar(); b.getChildren().addAll(this.buttons); return b; }
/** * This Method creates and defines a horizontal box with a button. */ public HBox addHorizontalBoxWithButton() { // set up horizontal box and button HBox hBox = new HBox(); hBox.setId("hBox"); hBox.setPadding(new Insets(10, 10, 10, 10)); hBox.setSpacing(10); // hBox.setStyle("-fx-background-colour: #FFFFFF;"); hBox.setAlignment(Pos.CENTER); Button startButton = new Button("CLICK ME"); startButton.setPrefSize(100, 30); // set up a message Text message = new Text("Click the button to get started."); message.setId("message"); hBox.getChildren().add(message); hBox.getChildren().add(startButton); return hBox; }
public class IPview { private ImageView imgWebCamCapturedImage; private BufferedImage grabbedImage; private ObjectProperty<Image> imageProperty = new SimpleObjectProperty<Image>(); private HBox hbox; public IPview(){ hbox = new HBox(); hbox.setPadding(new Insets(15, 12, 15, 12)); hbox.setSpacing(10); hbox.setStyle("-fx-background-color: #336699;"); Button buttonCurrent = new Button("Current"); buttonCurrent.setPrefSize(100, 20); Button buttonProjected = new Button("Projected"); buttonProjected.setPrefSize(100, 20); hbox.getChildren().addAll(buttonCurrent, buttonProjected); } public Node getView() { return hbox ; } }
public class EventSystemDemo extends Application { @Override public void start(Stage primaryStage) throws Exception { HBox box = new HBox(); box.setSpacing(12); box.setPadding(new Insets(12)); box.setFillHeight(true); box.setAlignment(Pos.CENTER); Flow senderFlow = new Flow(ProducerController.class); box.getChildren().add(senderFlow.start()); Flow receiverFlow = new Flow(ReceiverController.class); box.getChildren().add(receiverFlow.start()); primaryStage.setScene(new Scene(box)); primaryStage.show(); } public static void main(String... args) { launch(args); } }
/** * Creates and populates the Node that serves as the window toolbar. * * @return a newly constructed and populated toolbar component */ private Node makeToolbar() { // Auto-sizing spacer Region spacer = new Region(); HBox.setHgrow(spacer, Priority.ALWAYS); // Horizontal box containing toolbar controls HBox box = new HBox(); box.setPadding(new Insets(8)); box.setAlignment(Pos.CENTER); box.getChildren().addAll(openButton, spacer, resizeSlider); // Colored background panel with drop shadow Pane bgRect = new Pane(); bgRect.setStyle("-fx-background-color: #e0e0e0;"); bgRect.setEffect(DropShadowBuilder.create().width(1).build()); // StackPane to hold box and rectangle StackPane stack = new StackPane(); stack.getChildren().addAll(bgRect, box); return stack; }
public DefaultAboutPane() { setBackground(new Background(new BackgroundFill(Color.WHITE, null, null))); setPrefWidth(600); PowsyblLogo powsyblLogo = new PowsyblLogo(); powsyblLogo.setPrefSize(LOGO_SIZE, LOGO_SIZE); HBox logoPane = new HBox(PADDING, powsyblLogo); logoPane.getChildren().addAll(getAdditionalLogos()); logoPane.setPadding(new Insets(PADDING, PADDING, PADDING, PADDING)); setTop(logoPane); main = new VBox(PADDING, new Label(RESOURCE_BUNDLE.getString("JavaVersion") + ": " + SystemUtils.JAVA_VERSION), new Label(RESOURCE_BUNDLE.getString("RepositoryVersions") + ": "), createVersionTable()); main.setPadding(new Insets(PADDING, PADDING, PADDING, PADDING)); setCenter(main); }
protected void drawFooter() { HBox footer = new HBox(); footer.setAlignment(Pos.CENTER_RIGHT); footer.setPadding(new Insets(8)); footer.setSpacing(10); footer.setPrefHeight(45); footer.setId("footer"); getParent().getRoot().setBottom(footer); Button cancelButton = new Button(tr("Cancel")); nextButton = new Button(tr("Next")); footer.getChildren().addAll(cancelButton, nextButton); cancelButton.setOnMouseClicked(event -> { cancelButton.setDisable(true); messageWaitingForResponse.sendCancelSignal(); }); }
@Override public void start(Stage stage) { HBox hbox = new HBox(); hbox.setSpacing(10); hbox.setPadding(new Insets(20)); SplitPane splitPane1 = new SplitPane(); splitPane1.setOrientation(Orientation.VERTICAL); splitPane1.setPrefSize(200, 200); final Label l1 = new Label("Top Label"); final Label r1 = new Label("Bottom Label"); splitPane1.getItems().addAll(l1, r1); SplitPane splitPane2 = new SplitPane(); splitPane2.setOrientation(Orientation.HORIZONTAL); splitPane2.setPrefSize(400, 200); final Label c2 = new Label("Center Label"); final Label r2 = new Label("Right Label"); splitPane2.getItems().addAll(splitPane1, c2, r2); hbox.getChildren().add(splitPane2); Scene scene = new Scene(hbox); stage.setScene(scene); AquaFx.style(); stage.setTitle("SplitPane"); stage.show(); }
/** * {@inheritDoc} */ @Override protected void initView() { super.initView(); node().setStyle("-fx-background-color:white"); node().setPadding(new Insets(10, 20, 10, 20)); node().setSpacing(40); node().setAlignment(Pos.CENTER); this.selectAll = new CheckBox(); this.todoText = new TextField(); this.todoText.setPrefWidth(Integer.MAX_VALUE); HBox.setHgrow(this.todoText, Priority.ALWAYS); node().getChildren().addAll(this.selectAll, this.todoText); this.todoText.focusedProperty().addListener(this::textFocused); }