@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(); }
Button startButton = new Button("Start"); startButton.setOnAction(event -> { MessageProducer producer = new MessageProducer(messageQueue); Thread t = new Thread(producer); controls.setPadding(new Insets(10)); controls.setAlignment(Pos.CENTER); primaryStage.setScene(scene); primaryStage.show();
private void initializeContainers(Node node, boolean fullScreen, boolean max, boolean min) { buttonsContainer = new HBox(); buttonsContainer.getStyleClass().add("jfx-decorator-buttons-container"); buttonsContainer.setBackground(new Background(new BackgroundFill(Color.BLACK, CornerRadii.EMPTY, Insets.EMPTY))); buttonsContainer.setPadding(new Insets(4)); buttonsContainer.setAlignment(Pos.CENTER_RIGHT); buttonsContainer.addEventHandler(MouseEvent.MOUSE_CLICKED, (mouseEvent) -> { if (mouseEvent.getClickCount() == 2) { btnMax.fire(); graphicContainer = new HBox(); graphicContainer.setPickOnBounds(false); graphicContainer.setAlignment(Pos.CENTER_LEFT); graphicContainer.getChildren().setAll(text); HBox graphicTextContainer = new HBox(graphicContainer, text); graphicTextContainer.getStyleClass().add("jfx-decorator-title-container"); graphicTextContainer.setAlignment(Pos.CENTER_LEFT); graphicTextContainer.setPickOnBounds(false); HBox.setHgrow(graphicTextContainer, Priority.ALWAYS); HBox.setMargin(graphicContainer, new Insets(0, 8 , 0, 8)); buttonsContainer.getChildren().setAll(graphicTextContainer); buttonsContainer.getChildren().addAll(btns); buttonsContainer.addEventHandler(MouseEvent.MOUSE_ENTERED, (enter) -> allowMove = true); buttonsContainer.addEventHandler(MouseEvent.MOUSE_EXITED, (enter) -> {
/** * creates empty tool bar */ public JFXToolbar() { initialize(); this.setLeft(leftBox); leftBox.getStyleClass().add("tool-bar-left-box"); leftBox.setPickOnBounds(false); this.setRight(rightBox); rightBox.getStyleClass().add("tool-bar-right-box"); rightBox.setPickOnBounds(false); JFXDepthManager.setDepth(this, 1); }
private void updateContent() { paddingPane.setPrefSize(0, 0); paddingPane.setMinSize(0, 0); Node contentNode = content; switch (getDirection()) { case TOP: contentNode = new VBox(paddingPane, content); VBox.setVgrow(content, Priority.ALWAYS); break; case BOTTOM: contentNode = new VBox(content, paddingPane); VBox.setVgrow(content, Priority.ALWAYS); break; case LEFT: contentNode = new HBox(paddingPane, content); HBox.setHgrow(content, Priority.ALWAYS); break; case RIGHT: contentNode = new HBox(content, paddingPane); HBox.setHgrow(content, Priority.ALWAYS); break; } contentNode.setPickOnBounds(false); if (isOpened()) { paddingSizeProperty.set(computePaddingSize()); } contentHolder.getChildren().setAll(contentNode); }
BorderPane root = new BorderPane(); HBox hbox = new HBox(); Button backButton = new Button("Back"); Button deleteButton = new Button("Delete"); Button showAllButton = new Button("Show All"); rightButtons.setAlignment(Pos.CENTER_RIGHT); hbox.getChildren().addAll(backButton, rightButtons); hbox.setPadding(new Insets(2)); root.setBottom(hbox); Scene scene = new Scene(root, 600, 600); primaryStage.setScene(scene); primaryStage.show();
stage.setTitle("Validation Demo"); BorderPane borderPane = new BorderPane(); grid.setHgap(10); grid.setVgap(10); grid.setPadding(new Insets(25, 25, 25, 25)); grid.add(scenetitle, 0, 0, 2, 1); Label userName = new Label("User Name:"); grid.add(userName, 0, 1); grid.add(userTextField, 1, 1); Label pw = new Label("Password:"); grid.add(pw, 0, 2); grid.add(pwBox, 1, 2); Button btn = new Button("Sign in"); HBox hbBtn = new HBox(10); hbBtn.setAlignment(Pos.BOTTOM_RIGHT); hbBtn.getChildren().add(btn); grid.add(hbBtn, 1, 4); btn.setOnAction(new EventHandler<ActionEvent>() {
final Label lblTool = new Label(); HBox hBox = new HBox(); hBox.setSpacing(5.0); hBox.setPadding(new Insets(5, 5, 5, 5)); hBox.getChildren().add(lblTool); lblTool.setText(newValue.getTool()); BorderPane pane = new BorderPane(); pane.setTop(hBox); pane.setCenter(table); stage.setScene(new Scene(pane, 640, 480)); stage.show();
VBox vbCenter = new VBox(); // use any container as center pane e.g. VBox TextField console = new TextField(); vbCenter.getChildren().add(console); HBox hbButtons = new HBox(); Button scrapeBtn = new Button(); scrapeBtn.setText("Scrape!"); scrapeBtn.setOnAction(new EventHandler<ActionEvent>() { hbButtons .getChildren().add(scrapeBtn); BorderPane root = new BorderPane(); root.setPadding(new Insets(20)); // space between elements and window border root.setCenter(vbCenter); root.setBottom(hbButtons); primaryStage.setTitle("Wiki Scraper"); primaryStage.setScene(scene); primaryStage.show();
Keyboard keyboard = new Keyboard(); VBox layout = new VBox(20); layout.setPadding(new Insets(10)); layout.getChildren().setAll( createControls(keyboard), ); stage.setScene(scene); stage.show(); fontSize.setMinorTickCount(0); VBox layout = new VBox(10); layout.getChildren().setAll( new Label("Keyboard Size"), HBox keyRow = new HBox(); keyRow.getStyleClass().add("key-row"); keyRow.setAlignment(Pos.CENTER); for (char c: row.toCharArray()) { KeyButton key = new KeyButton(Character.toString(c)); keyRow.getChildren().add(key);
BorderPane settings = new BorderPane(); settings.setPadding(new Insets(10)); Button playBtn = new Button("Play"); Label zombieLabel = new Label("Zombie Dice"); zombieLabel.setStyle("-fx-font-size: 60"); zombieLabel.setAlignment(Pos.CENTER); HBox zomBox = new HBox(); zomBox.getChildren().add(zombieLabel); zomBox.setAlignment(Pos.CENTER); Label indicateLabel = new Label("Indicate who is playing"); indicateLabel.setStyle("-fx-font-size: 20"); indicateLabel.setAlignment(Pos.CENTER); HBox indBox = new HBox(); indBox.getChildren().add(indicateLabel); indBox.setAlignment(Pos.CENTER); gridPane.setAlignment(Pos.CENTER); HBox hBox = new HBox(10); hBox.getChildren().addAll(playBtn); hBox.setAlignment(Pos.CENTER); stage.setScene(root); stage.show();
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(); }
@Override public void start(Stage primaryStage) { HBox hbox = new HBox(); Button b = new Button("add"); b.setOnAction(ev -> hbox.getChildren().add(new Label("Test"))); ScrollPane scrollPane = new ScrollPane(hbox); scrollPane.setFitToHeight(true); BorderPane root = new BorderPane(scrollPane); root.setPadding(new Insets(15)); root.setTop(b); Scene scene = new Scene(root, 400, 400); primaryStage.setScene(scene); primaryStage.show(); }
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); } }
HBox root = new HBox(); root.setPadding(new Insets(10, 10, 10, 10)); final Button left = new Button("Left"); left.setMinSize(Button.USE_PREF_SIZE, Button.USE_PREF_SIZE); final Pane spacer = new Pane(); HBox.setHgrow(spacer, Priority.ALWAYS); spacer.setMinSize(10, 1); final Button right = new Button("Right"); right.setMinSize(Button.USE_PREF_SIZE, Button.USE_PREF_SIZE); root.getChildren().addAll(left, spacer, right); primaryStage.setScene(new Scene(root, 400, 400)); primaryStage.show();
); HBox layout = new HBox(10); layout.getChildren().addAll( new ImageView(coke), blend, new ImageView(pepsi) ); layout.setPadding(new Insets(10)); stage.setScene(new Scene(layout)); stage.show();
final HBox hbox = new HBox(); final VBox vbox = new VBox(); Stage primaryStage = new Stage(); Scene scene = new Scene(new Group()); paddedButton.setPadding(new Insets(3)); vbox.getChildren().add(img); hbox.getChildren().add(vbox); hbox.setPadding(new Insets(30, 5, 5, 5));
/** * 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 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 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 ; } }