Java 类javafx.scene.layout.HBoxBuilder 实例源码

项目:marathonv5    文件:ComboBoxSample.java   
public ComboBoxSample() {

        HBox hbox = HBoxBuilder.create().alignment(Pos.CENTER).spacing(15).build();

        //Non-editable combobox. Created with a builder
        ComboBox uneditableComboBox = ComboBoxBuilder.create()
                .id("uneditable-combobox")
                .promptText("Make a choice...")
                .items(FXCollections.observableArrayList(strings.subList(0, 8))).build();

        //Editable combobox. Use the default item display length
        ComboBox<String> editableComboBox = new ComboBox<String>();
        editableComboBox.setId("second-editable");
        editableComboBox.setPromptText("Edit or Choose...");
        editableComboBox.setItems(strings);
        editableComboBox.setEditable(true);

        hbox.getChildren().addAll(uneditableComboBox, editableComboBox);
        getChildren().add(hbox);
    }
项目:marathonv5    文件:ComboBoxSample.java   
public ComboBoxSample() {

        HBox hbox = HBoxBuilder.create().alignment(Pos.CENTER).spacing(15).build();

        //Non-editable combobox. Created with a builder
        ComboBox uneditableComboBox = ComboBoxBuilder.create()
                .id("uneditable-combobox")
                .promptText("Make a choice...")
                .items(FXCollections.observableArrayList(strings.subList(0, 8))).build();

        //Editable combobox. Use the default item display length
        ComboBox<String> editableComboBox = new ComboBox<String>();
        editableComboBox.setId("second-editable");
        editableComboBox.setPromptText("Edit or Choose...");
        editableComboBox.setItems(strings);
        editableComboBox.setEditable(true);

        hbox.getChildren().addAll(uneditableComboBox, editableComboBox);
        getChildren().add(hbox);
    }
项目:javafx-demos    文件:AnimationsAndMnenomicsDemo.java   
private void configureSlideToLeft() {
    StackPane container = new StackPane();
    container.setMinSize(400, 250);
    container.setStyle("-fx-border-color:red;-fx-border-width:1px;");

    StackPane basePane =  new StackPane();
    basePane.setStyle("-fx-background-color: linear-gradient(to bottom, #4977A3, #B0C6DA, #9CB6CF);");

    HBox slidePane = HBoxBuilder.create().padding(new Insets(0,0,0,10)).build();
    StackPane slideButton = StackPaneBuilder.create().style(slideButtonCss()).minWidth(30).build();
    StackPane slideContent = StackPaneBuilder.create().style(slideContentCss()).children(new Label("This is check for length of the contact pane demo in slide.")).build();
    slidePane.getChildren().addAll(slideButton,slideContent);
    HBox.setHgrow(slideContent, Priority.ALWAYS);

    Rectangle clipRect = new Rectangle();

    container.getChildren().addAll(slidePane);
    root.getChildren().addAll(container);
}
项目:javafx-demos    文件:ToggleButtonGraphicStylingDemo.java   
@Override
public void start(Stage stage) throws Exception {
    this.stage = stage;
    configureScene();
    configureStage();
    ToggleGroup tg = new ToggleGroup();
    final ToggleButton tb1 = ToggleButtonBuilder.create().styleClass("graphic-toggle-button").toggleGroup(tg).graphic(buildDiseaseStatusIcon(true)).text("Not present in family").build();
    tb1.setOnAction(new EventHandler<ActionEvent>() {
        @Override
        public void handle(ActionEvent arg0) {
            if(tb1.selectedProperty().get()){
                System.out.println("Selected");
            }else{
                System.out.println("Deselected");
            }
        }
    });
    ToggleButton tb2 = ToggleButtonBuilder.create().styleClass("graphic-toggle-button").toggleGroup(tg).graphic(buildDiseaseStatusIcon(false)).text("Not present in family").build();

    // Logic starts
    HBox hb = HBoxBuilder.create().spacing(15).build();
    hb.getChildren().addAll(tb1,tb2);
    root.getChildren().add(hb);
    //ScenicView.show(scene);
}
项目:javafx-demos    文件:SimpleVerticalScrollerDemo.java   
@Override
public void start(Stage stage) throws Exception {
    this.stage = stage;
    configureScene();
    configureStage();
    // Logic starts
    HBox hb = HBoxBuilder.create().padding(new Insets(15)).alignment(Pos.CENTER_LEFT).build();

    SimpleVerticalScroller scroller = new SimpleVerticalScroller();
    scroller.setMinHeight(300);
    scroller.setPrefHeight(300);
    hb.getChildren().add(scroller);

    for (int i = 0; i < 10; i++) {
        scroller.getItems().add(new SimpleVerticalScrollerItem(StackPaneBuilder.create().minHeight(20).maxHeight(20).style("-fx-background-color:black,yellow;-fx-background-insets:0,1;").build()));
    }
    root.setPadding(new Insets(15));
    root.getChildren().add(hb);
}
项目:kotlinfx-ensemble    文件:ComboBoxSample.java   
public ComboBoxSample() {

        HBox hbox = HBoxBuilder.create().alignment(Pos.CENTER).spacing(15).build();

        //Non-editable combobox. Created with a builder
        ComboBox uneditableComboBox = ComboBoxBuilder.create()
                .id("uneditable-combobox")
                .promptText("Make a choice...")
                .items(FXCollections.observableArrayList(strings.subList(0, 8))).build();

        //Editable combobox. Use the default item display length
        ComboBox<String> editableComboBox = new ComboBox<String>();
        editableComboBox.setId("second-editable");
        editableComboBox.setPromptText("Edit or Choose...");
        editableComboBox.setItems(strings);
        editableComboBox.setEditable(true);

        hbox.getChildren().addAll(uneditableComboBox, editableComboBox);
        getChildren().add(hbox);
    }
项目:lawless-legends    文件:UIAction.java   
public static void choose(String message, Choice... choices) {
    final Stage dialogStage = new Stage();

    HBoxBuilder options = HBoxBuilder.create().alignment(Pos.CENTER).spacing(10.0).padding(new Insets(5));
    List<Button> buttons = new ArrayList<>();
    for (final Choice c : choices) {
        Button b = new Button(c.text);
        b.setOnAction((ActionEvent t) -> {
            if (c.handler != null) {
                c.handler.run();
            }
            dialogStage.close();
        });
        buttons.add(b);
    }
    options.children(buttons);
    dialogStage.initModality(Modality.WINDOW_MODAL);
    dialogStage.setScene(new Scene(VBoxBuilder.create().
            children(new Text(message), options.build()).
            alignment(Pos.CENTER).padding(new Insets(5)).build()));
    dialogStage.show();
}
项目:xpanderfx    文件:MainFXMLDocumentController.java   
/**
 * About content
 */
@SuppressWarnings("deprecation")
private void showAboutContent() {
    try {
        Node content = FXMLLoader.load(getClass().getResource("/com/shekkar/xpanderfx/top/popup/AboutFXMLDocument.fxml"));
        about_box = new VBox();
        about_box.getChildren().addAll(content,
                HBoxBuilder.create().alignment(Pos.CENTER_RIGHT)
                .padding(new Insets(0,3,0,0))
                .children(
                      ButtonBuilder.create().text("OK")
                      .minHeight(40)
                      .minWidth(70)
                      .style("-fx-base:black;"
                    + "-fx-border-radius: 7;"
                    + "-fx-background-radius: 7;")
                      .onAction(e -> this.popupCloser(about, about_box))
                      .font(Font.font("System", FontWeight.MEDIUM, FontPosture.REGULAR, 20))
                      .build()
                )
                .build()
             );
        about_box.setStyle("-fx-background-color: linear-gradient(black, lightgrey);"
             + "-fx-background-radius: 7;"
             + "-fx-border-radius: 7;");
        about.getContent().add(about_box);
    } catch (IOException ex) {
        Logger.getLogger(MainFXMLDocumentController.class.getName()).log(Level.SEVERE, null, ex);
    }
    about.show(this.ICON.getScene().getWindow(), this.getNodeMaxX() - 14, this.getNodeMaxY() + 12);
    this.popupOpener(about_box);        
}
项目:xpanderfx    文件:GameOver.java   
/**
 * 
 * @return center_box
 */
private HBox getCenterBox() {
    @SuppressWarnings("deprecation")
    HBox center = HBoxBuilder.create()
         .children(LabelBuilder.create().text("Game Over!!")
            .textFill(Color.BLACK)
             .font(Font.font("System", FontWeight.MEDIUM, FontPosture.REGULAR, 30))
             .build())
         .alignment(Pos.CENTER)
         .build();
    return center;
}
项目:xpanderfx    文件:GameOver.java   
/**
 * 
 * @param controller
 * @return bottom_box
 */
private HBox getBottomBox(MainFXMLDocumentController controller) {
    @SuppressWarnings("deprecation")
    HBox bottom = HBoxBuilder.create()
         .alignment(Pos.CENTER)
         .spacing(10)
         .padding(new Insets(5,5,5,5))
         .children(getRestartButton(controller), getQuitButton(controller))
         .build();
    return bottom;
}
项目:xpanderfx    文件:Completion.java   
/**
 * 
 * @return root-node
 */
@SuppressWarnings("deprecation")
private BorderPane getBody() {
    return BorderPaneBuilder.create().minHeight(200).minWidth(440).center(
            VBoxBuilder.create().alignment(Pos.CENTER).children(
                    LabelBuilder.create()
                            .minHeight(10).build(),
                    LabelBuilder.create().text("Congratulation !! You won the game.")
                        .font(Font.font("", FontWeight.BOLD, FontPosture.ITALIC, 20))
                            .textFill(Color.WHITE).build(),
                    LabelBuilder.create()
                            .minHeight(30).build(),
                    HBoxBuilder.create().alignment(Pos.CENTER).spacing(20).children(
                            ButtonBuilder.create().text("Continue").font(Font.font("", FontWeight.SEMI_BOLD, FontPosture.REGULAR, 18))
                                    .minWidth(140).textFill(Color.WHITE).style("-fx-base:darkslategrey")
                                    .onAction(e -> this.close()).build(),
                            ButtonBuilder.create().text("Try Again").font(Font.font("", FontWeight.SEMI_BOLD, FontPosture.REGULAR, 18))
                                    .minWidth(140).textFill(Color.WHITE).style("-fx-base:darkslategrey")
                                    .onAction(e -> {
                                        controller.restart();   
                                        this.close();
                                    }).build()
                    ).build()
            )
            .build()
    ).style("-fx-background-color: linear-gradient(#000000cc, darkslategrey); -fx-background-radius: 15; -fx-border-radius:15;"
            + "-fx-border-width:1; -fx-border-color:lightgrey").build();
}
项目:mars-sim    文件:Story.java   
/** @return the content of the address, with a signature and portrait attached. */
private Pane getContent() {
  final VBox content = new VBox();
  content.getStyleClass().add("address");

  //int rand = RandomUtil.getRandomInt(1);

  final Label address = new Label(START1+START2+MID1+MID2+MID3+MID4);

  address.setWrapText(true);
  ScrollPane addressScroll = makeScrollable(address);

  final ImageView signature = new ImageView(); signature.setId("signature");
  final ImageView lincolnImage = new ImageView(); lincolnImage.setId("portrait");
  VBox.setVgrow(addressScroll, Priority.ALWAYS);

  final Region spring = new Region();
  HBox.setHgrow(spring, Priority.ALWAYS);
  final Node alignedSignature = HBoxBuilder.create().children(spring, signature).build();

  Label date = new Label(DATE);
  date.setAlignment(Pos.BOTTOM_RIGHT);

  content.getChildren().addAll(
      lincolnImage,
      addressScroll,
      alignedSignature,
      date
  );

  return content;
}
项目:javafx-demos    文件:SimpleListViewDemo.java   
private void configureHeaderListView() {
    ObservableList<ListData> list = getListData();
    ListView<ListData> listView = new ListView<ListData>();
    listView.setItems(list);
    listView.setCellFactory(new Callback<ListView<ListData>, ListCell<ListData>>() {
        @Override
        public ListCell<ListData> call(ListView<ListData> arg0) {
            return new ListCell<ListData>() {
                @Override
                public void updateItem(ListData item, boolean empty) {
                    super.updateItem(item, empty);
                    if (!isEmpty()) {
                        HBox hb = HBoxBuilder.create().spacing(20).children(new Label(item.getCode()), new Label(item.getDesc())).build();
                        setGraphic(hb);
                    }
                }
            };
        }
    });

    listView.setPrefWidth(300);
    listView.getSelectionModel().selectedItemProperty().addListener(new ChangeListener<ListData>() {
        @Override
        public void changed(ObservableValue<? extends ListData> paramObservableValue, ListData paramT1, ListData paramT2) {
            System.out.println("----------------------------> " + paramT2.getCode());
        }
    });
    root.getChildren().addAll(listView);
}
项目:javafx-demos    文件:CustomTextFieldDemo.java   
private void configureScroller() {
    CustomTextField field = new CustomTextField();
    field.setType(CustomTextField.TextFieldType.POSITIVE_INTEGER);
    field.setPromptText("hello");
    field.setMaxCharLength(5);
    HBox hb1 = HBoxBuilder.create().spacing(10).children(new Label("INTEGER_ONLY   : ") 
                                                            ,CustomTextFieldBuilder.create()
                                                                    .type(CustomTextField.TextFieldType.POSITIVE_INTEGER)
                                                                    .maxCharLength(5).build()
                                                    ).build();

    CustomPromptTextField promptField = new CustomPromptTextField();
    promptField.setPromptText("Enter value");

    vb.getChildren().addAll(HBoxBuilder.create().spacing(10)
                                       .children(new Label("POSITIVE_INTEGER   : ") 
                                                    ,CustomTextFieldBuilder.create()
                                                         .type(CustomTextField.TextFieldType.POSITIVE_INTEGER)
                                                         .maxCharLength(5).build() ).build()

                               ,HBoxBuilder.create().spacing(10)
                                       .children(new Label("ALPHABET   : ") 
                                       ,CustomTextFieldBuilder.create()
                                            .type(CustomTextField.TextFieldType.ALPHABET)
                                            .maxCharLength(5).build() ).build()

                           ,HBoxBuilder.create().spacing(10)
                                       .children(new Label("Double   : ") 
                                       ,CustomTextFieldBuilder.create()
                                            .type(CustomTextField.TextFieldType.DOUBLE)
                                            .maxCharLength(13).build() ).build()
                           ,promptField
                           ,TextFieldBuilder.create().promptText("Enter value").build()

            );

}
项目:javafx-demos    文件:StarterDemo.java   
@Override
public void start(Stage stage) throws Exception {
    this.stage = stage;
    configureScene();
    configureStage();
    HBox hb = HBoxBuilder.create().spacing(15).build();
    for (int i = 0; i < 10; i++) {
        hb.getChildren().add(new Starter(new Image(StarterDemo.class.getResourceAsStream("/images/Koala.jpg")), 100,100));
    }
    root.getChildren().add(hb);
}
项目:javafx-demos    文件:CustomTextFieldDemo.java   
@Override
public void start(Stage stage) throws Exception {
    this.stage = stage;
    vb1 = new VBox();
    vb1.setSpacing(8);
    vb2 = new VBox();
    vb2.setSpacing(8);
    configureScene();
    configureStage();
    configureScroller();
    root.getChildren().add(HBoxBuilder.create().spacing(20).children(vb1, vb2).build());
}
项目:javafx-demos    文件:FreeTextFieldDemo.java   
@Override
public void start(Stage stage) throws Exception {
    this.stage = stage;
    configureScene();
    configureStage();
    VBox vb = VBoxBuilder.create().spacing(15).build();

    FreeTextField ff = new FreeTextField();
    vb.getChildren().add(HBoxBuilder.create().children(ff).build());
    root.getChildren().add(vb);
}
项目:CrocodileNote    文件:Popups.java   
public void create(String msg, ReturnListener rl, int focusid, String... buttons){
    setReturnListener(rl);

    myDialog = new Stage();
    myDialog.initModality(Modality.APPLICATION_MODAL);
    myDialog.setResizable(false);
    myDialog.setTitle(/*Base.appname*/ "Warning");
    myDialog.getIcons().add(ico);

    ImageView iv = new ImageView(warn);

    Button[] bs = createButtons(buttons);

    HBox hb = HBoxBuilder.create().children(iv, t(msg))
            .spacing(10)
            .padding(new Insets(10))
            .build();
    hb.setAlignment(Pos.TOP_LEFT);

    TilePane tileButtons = new TilePane(Orientation.HORIZONTAL);
    tileButtons.setPadding(new Insets(0, 0, 5, 0));
    tileButtons.setHgap(20);
    tileButtons.setAlignment(Pos.CENTER);
    tileButtons.getChildren().addAll(bs);
    tileButtons.setPrefColumns(bs.length);

    VBox vb = VBoxBuilder.create().children(hb, tileButtons).build();

    myDialog.setScene(new Scene(vb, Color.WHITESMOKE));
    myDialog.sizeToScene();
    myDialog.show();

    if(focusid > 0 && focusid < bs.length)
        bs[focusid].requestFocus();
}
项目:javafx-demos    文件:TriangleArea.java   
@Override public void start(Stage stage) {
  final Group root;
  Scene scene = SceneBuilder.create()
    .width(500).height(500)
    .fill(Color.WHITE)
    .root(root = GroupBuilder.create()
      .children(RectangleBuilder.create()
        .layoutX(5).layoutY(5)
        .width(490).height(490)
        .fill(Color.LIGHTSKYBLUE)
        .onMouseClicked(new EventHandler<MouseEvent>() {
          // Eventhandler for mouse click event
          @Override public void handle(MouseEvent e) {
            if (clickcount > 2) { initialize(); }
            for (int j = clickcount; j < 3; j++) {
              org_x[j].set(e.getSceneX());
              org_y[j].set(e.getSceneY());
            }
            clickcount++;
          }
        }).build(),
      // line for x-axis through the Origin
      LineBuilder.create()
        .startX(5).startY(490)
        .endX(495).endY(490)
        .build(),
      // Line for y-axis through the Origin
      LineBuilder.create()
        .startX(10).startY(5)
        .endX(10).endY(495)
        .build(),
      // grid horizontal lines which interval is of 1cm
      a_x_l[0], a_x_l[1], a_x_l[2], a_x_l[3],
      a_x_l[4], a_x_l[5], a_x_l[6], a_x_l[7],
      a_x_l[8], a_x_l[9], a_x_l[10], a_x_l[11],
      // grid vertical lines which interval is of 1cm
      a_y_l[0], a_y_l[1], a_y_l[2], a_y_l[3],
      a_y_l[4], a_y_l[5], a_y_l[6], a_y_l[7],
      a_y_l[8], a_y_l[9], a_y_l[10], a_y_l[11],
      // Sides
      l[0], l[1], l[2],
      // Vertices
      c[0], c[1], c[2],
      // the printing space of the coordinates and
      // the area of triangle
      HBoxBuilder.create()
        .layoutX(10)
        .padding(new Insets(10, 10, 10, 10)).spacing(3)
        .alignment(Pos.BOTTOM_CENTER)
        .children(
          LabelBuilder.create().text("A(").build(),
          tx[0],
          LabelBuilder.create().text(",").build(),
          ty[0],
          LabelBuilder.create().text("),").build(),
          LabelBuilder.create().text("B(").build(),
          tx[1],
           LabelBuilder.create().text(",").build(),
          ty[1],
          LabelBuilder.create().text("),").build(),
          LabelBuilder.create().text("C(").build(),
          tx[2],
          LabelBuilder.create().text(",").build(),
          ty[2],
          LabelBuilder.create().text(") ⇒ ").build(),
          area_Label
        ).build()
    ).build()
  ).build();

  stage.setTitle("Triangle Area");
  stage.setScene(scene);
  stage.show();
}
项目:javafx-demos    文件:HorizontalDock.java   
public HorizontalDock() {
    hBox = HBoxBuilder.create().spacing(10).alignment(Pos.CENTER_RIGHT).build();
    getChildren().add(hBox);

}