javafx.scene.layout.HBox.getChildren()方法的使用及代码示例

x33g5p2x  于2022-01-20 转载在 其他  
字(9.1k)|赞(0)|评价(0)|浏览(176)

本文整理了Java中javafx.scene.layout.HBox.getChildren()方法的一些代码示例,展示了HBox.getChildren()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。HBox.getChildren()方法的具体详情如下:
包路径:javafx.scene.layout.HBox
类名称:HBox
方法名:getChildren

HBox.getChildren介绍

暂无

代码示例

代码示例来源:origin: stackoverflow.com

HBox hbox = new HBox();
Label label = new Label("(empty)");
Pane pane = new Pane();
Button button = new Button("(>)");
String lastItem;
  hbox.getChildren().addAll(label, pane, button);
  HBox.setHgrow(pane, Priority.ALWAYS);
  button.setOnAction(new EventHandler<ActionEvent>() {
StackPane pane = new StackPane();
Scene scene = new Scene(pane, 300, 150);
primaryStage.setScene(scene);
ObservableList<String> list = FXCollections.observableArrayList(
    "Item 1", "Item 2", "Item 3", "Item 4");
primaryStage.show();

代码示例来源:origin: jfoenixadmin/JFoenix

setText(null);
  if (hbox == null) {
    hbox = new HBox(3);
  hbox.getChildren().setAll(treeItem.getGraphic(), (Node) item);
  setGraphic(hbox);
} else {

代码示例来源:origin: stackoverflow.com

vb.setPadding( new Inset(10,10,10,10) );
vb.setSpacing( 10 );
Button yesButton = new Button( "Yes" );
yesButton.setOnAction( new EventHandler<ActionEvent>() {
  @Override public void handle( ActionEvent e ) {
Button noButton = new Button( "No" );
noButton.setOnAction( new EventHandler<ActionEvent>() {
  @Override public void handle( ActionEvent e ) {
HBox buttons = new HBox();
buttons.setAlignment( Pos.CENTER );
buttons.setSpacing( 10 );
buttons.getChildren().addAll( yesButton, noButton );
bp.setCenter( buttons );
HBox msg = new HBox();
msg.setSpacing( 5 );
msg.getChildren().addAll( icon, new Message( message ) );
vb.setPadding( new Inset(10,10,10,10) );
vb.setSpacing( 10 );
Button okButton = new Button( "OK" );
okButton.setAlignment( Pos.CENTER );
okButton.setOnAction( new EventHandler<ActionEvent>() {

代码示例来源:origin: stackoverflow.com

HBox hbox = new HBox();
 Label label = new Label("file");
 ImageView imageView = new ImageView("path to image");
 hbox.getChildren().add(label);
 hbox.getChildren().add(imageView);
 TreeItem itm = new TreeItem(hbox);
 rootItem.getChildren().add(itm);

代码示例来源:origin: stackoverflow.com

//For example, if an hbox needs the TextField to be allocated all extra space:
HBox hbox = new HBox();
TextField field = new TextField();
HBox.setHgrow(field, Priority.ALWAYS);
hbox.getChildren().addAll(new Label("Search:"), field, new Button("Go"));

代码示例来源:origin: stackoverflow.com

...
HBox box5 = createBox();
Circle c5 = new Circle(20);
c5.setScaleX(scale);
c5.setScaleY(scale);
box5.getChildren().add(new Group(c5));
box5.getChildren().add(new Label("Test with the Scale transform and a group"));
...

代码示例来源:origin: stackoverflow.com

@FXML
HBox buttonBox // assuming your button container is a HBox
...

@FXML
protected void initialize() {
  buttonBox.getChildren().add(new Button("Click me!"));
}

代码示例来源:origin: stackoverflow.com

new Label("500: Aug 8, 12:15pm"), 
 new Label("404: Aug 7, 3:27am")
).build();
Label nErrors = new Label();
nErrors.getStyleClass().add("nerrors");
nErrors.textProperty().bind(Bindings.size(errorPane.getChildren()).asString());
);
HBox layout = new HBox(10);
layout.setStyle("-fx-padding: 10; -fx-background-color: cornsilk;");
layout.getChildren().addAll(adminPane, viewPane, connectivityPane);
layout.setPrefHeight(150);
layout.getStylesheets().add(this.getClass().getResource("titledpanecustomization.css").toExternalForm());
primaryStage.setScene(new Scene(layout));
primaryStage.show();

代码示例来源:origin: stackoverflow.com

HBox hbox = new HBox();
// the text of the "button"
Label lbl_txt = new Label("Text");
// the icon of the "button", i am using Labels for icon(with css)
Label lbl_ico = new Label("ico");
hbox.getChildren().addAll(lbl_txt, lbl_ico);
hbox.setOnMouseClicked(new EventHandler<MouseEvent>() {
  @Override
  public void handle(MouseEvent t) {
    // alternative to Button click
  }
});

代码示例来源:origin: stackoverflow.com

HBox hbox = new HBox();
  TextField field = new TextField();
  HBox.setHgrow(field, Priority.ALWAYS);
  hbox.getChildren().addAll(new Label("Search:"), field, new Button("Go"));

代码示例来源:origin: stackoverflow.com

HBox box = new HBox();
Button confirm = new Button();
box.getChildren().add(confirm);
borderPane.setBottom(box);

代码示例来源:origin: jfoenixadmin/JFoenix

selectedYearLabel.setFont(Font.font(ROBOTO, FontWeight.BOLD, 14));
HBox yearLabelContainer = new HBox();
yearLabelContainer.getStyleClass().add("spinner");
yearLabelContainer.getChildren().addAll(selectedYearLabel);
yearLabelContainer.setAlignment(Pos.CENTER_LEFT);
yearLabelContainer.setFillHeight(false);
selectedDateLabel.setFont(Font.font(ROBOTO, FontWeight.BOLD, 32));
HBox selectedDateContainer = new HBox(selectedDateLabel);
selectedDateContainer.getStyleClass().add("spinner");
selectedDateContainer.setAlignment(Pos.CENTER_LEFT);

代码示例来源:origin: jfoenixadmin/JFoenix

@Override
public void start(Stage primaryStage) throws Exception {
  JFXComboBox<Label> combo = new JFXComboBox<>();
  combo.getItems().add(new Label("Java 1.8"));
  combo.getItems().add(new Label("Java 1.7"));
  combo.getItems().add(new Label("Java 1.6"));
  combo.getItems().add(new Label("Java 1.5"));
  combo.setEditable(true);
  combo.setPromptText("Select Java Version");
  combo.setConverter(new StringConverter<Label>() {
    @Override
    public String toString(Label object) {
      return object==null? "" : object.getText();
    }
    @Override
    public Label fromString(String string) {
      return new Label(string);
    }
  });
  HBox pane = new HBox(100);
  HBox.setMargin(combo, new Insets(20));
  pane.setStyle("-fx-background-color:WHITE");
  pane.getChildren().add(combo);
  final Scene scene = new Scene(pane, 300, 300);
  scene.getStylesheets().add(ComboBoxDemo.class.getResource("/css/jfoenix-components.css").toExternalForm());
  primaryStage.setTitle("JFX ComboBox Demo");
  primaryStage.setScene(scene);
  primaryStage.setResizable(false);
  primaryStage.show();
}

代码示例来源:origin: stackoverflow.com

DatePicker datePicker = new DatePicker();
datePicker.setMinHeight(12.);
datePicker.setPrefHeight(16.);
HBox hBox = new HBox();
hBox.getChildren().add(new Label("DatePicker with 16px height"));
hBox.getChildren().add(datePicker);

代码示例来源:origin: stackoverflow.com

HBox hbox = new HBox();
TextField field = new TextField();
HBox.setHgrow(field, Priority.ALWAYS);
hbox.getChildren().addAll(new Label("Search:"), field, new Button("Go"));

代码示例来源:origin: stackoverflow.com

root.setValue("");
Text text = new Text("Root");
Button button = new Button("Hello!");
HBox hbox = new HBox(5);
hbox.getChildren().addAll(text, button);
root.setGraphic(vbox);

代码示例来源:origin: jfoenixadmin/JFoenix

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,
  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);
  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) -> {

代码示例来源:origin: jfoenixadmin/JFoenix

@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();
}

代码示例来源:origin: stackoverflow.com

public void tagButton(HBox box,String tag){
  ImageView closeImg = new ImageView(toUse);
  HBox button = new HBox();
  button.setStyle("-fx-padding:4;" +
      "        -fx-border-width: 2;" +
      "        -fx-border-color: black;" +
      "        -fx-border-radius: 4;" +
      "        -fx-background-color: f1f1f1;" +
      "        -fx-border-insets: 5;");
  button.setPrefHeight(20);
  button.getChildren().addAll(new Label(tag),closeImg);

  closeImg.setOnMouseClicked(event -> 
      box.getChildren().remove(button)
  );
  button.setOnMouseClicked(event -> {
    //doSomethig
  });

  box.getChildren().add(button);
}

代码示例来源:origin: stackoverflow.com

Button xButton = new Button("X");
Button obutton = new Button("O");

HBox buttonBar = new HBox();
buttonBar.getChildren().addAll(xButton, oButton);

borderPane.setTop(buttonBar);

相关文章