Example usage for javafx.scene.layout HBox setFillHeight

List of usage examples for javafx.scene.layout HBox setFillHeight

Introduction

In this page you can find the example usage for javafx.scene.layout HBox setFillHeight.

Prototype

public final void setFillHeight(boolean value) 

Source Link

Usage

From source file:com.github.drbookings.ui.controller.BookingDetailsController.java

private static void addRow4(final Pane content, final BookingBean be) {
    final HBox box = new HBox();
    box.setPadding(new Insets(4));
    box.setAlignment(Pos.CENTER_LEFT);/* ww  w  .  j  a  v  a  2s .c om*/
    box.setFillHeight(true);
    final TextFlow tf = new TextFlow();
    final Text t0 = new Text("Net Earnings: \t");
    final Text netEarnings = new Text(String.format("%3.2f", be.getNetEarnings()));
    final Text t1 = new Text(" total \t");
    final Text netEarningsDay = new Text(String.format("%3.2f", be.getNetEarnings() / be.getNumberOfNights()));
    final Text t2 = new Text(" /night");
    tf.getChildren().addAll(t0, netEarnings, t1, netEarningsDay, t2);
    box.getChildren().addAll(tf);
    if (be.getNetEarnings() <= 0) {
        box.getStyleClass().addAll("warning", "warning-bg");
    }
    content.getChildren().add(box);

}

From source file:Main.java

@Override
public void start(Stage primaryStage) {
    Group root = new Group();
    Scene scene = new Scene(root, 300, 250, Color.WHITE);

    HBox hbox = new HBox();
    Button button1 = new Button("Add");
    Button button2 = new Button("Remove");
    HBox.setHgrow(button1, Priority.ALWAYS);
    HBox.setHgrow(button2, Priority.ALWAYS);
    button1.setMaxWidth(Double.MAX_VALUE);
    button2.setMaxWidth(Double.MAX_VALUE);
    hbox.getChildren().addAll(button1, button2);

    hbox.setPrefWidth(400);/*from   www. j a v a  2s .com*/

    hbox.setFillHeight(true);

    root.getChildren().add(hbox);
    primaryStage.setScene(scene);
    primaryStage.show();
}

From source file:com.github.drbookings.ui.controller.BookingDetailsController.java

private void addRow5(final Pane content, final BookingBean be) {
    final HBox box = new HBox();
    box.setPadding(new Insets(4));
    box.setFillHeight(true);
    final Text text = new Text("Welcome Mail sent: ");
    final CheckBox checkBox = new CheckBox();
    checkBox.setSelected(be.isWelcomeMailSend());
    booking2WelcomeMail.put(be, checkBox);
    final Text t1 = new Text(" \tPayment done: ");

    final CheckBox cb1 = new CheckBox();
    cb1.setSelected(be.isPaymentDone());

    //if (logger.isDebugEnabled()) {
    //   logger.debug("DateOfPayment for " + be + "(" + be.hashCode() + ") is " + be.getDateOfPayment());
    //}//from w w  w .  ja va 2  s. c  om

    final DatePicker dp = new DatePicker();
    dp.setValue(be.getDateOfPayment());

    dp.setPrefWidth(140);
    booking2PaymentDate.put(be, dp);

    booking2Payment.put(be, cb1);
    final TextFlow tf = new TextFlow();
    tf.getChildren().addAll(text, checkBox, t1, cb1, dp);
    box.getChildren().add(tf);
    if (!be.isWelcomeMailSend() || !be.isPaymentDone()) {
        box.getStyleClass().addAll("warning", "warning-bg");
    } else {
        box.getStyleClass().removeAll("warning", "warning-bg");
    }

    HBox box2 = new HBox();
    box2.setPadding(new Insets(4));
    box2.setFillHeight(true);
    TextField newPayment = new TextField();
    Button addNewPaymentButton = new Button("Add payment");
    addNewPaymentButton.setOnAction(e -> {
        addNewPayment(newPayment.getText(), be);
    });
    box2.getChildren().addAll(newPayment, addNewPaymentButton);

    content.getChildren().addAll(box, box2);

}

From source file:com.github.drbookings.ui.controller.BookingDetailsController.java

private void addRow1(final Pane content, final BookingBean be) {
    final VBox box = new VBox();
    final HBox box0 = new HBox();
    final HBox box1 = new HBox();
    final HBox box2 = new HBox();
    box.setFillWidth(true);//w  ww . ja va  2  s .co  m
    box0.setFillHeight(true);
    box1.setFillHeight(true);
    box2.setFillHeight(true);
    addCheckInNote(box0, be);
    addCheckOutNote(box1, be);
    addSpecialRequestNote(box2, be);
    box.getChildren().addAll(box0, box1, box2);
    final TitledPane pane = new TitledPane("Notes", box);
    pane.setExpanded(false);
    content.getChildren().add(pane);

}

From source file:com.github.drbookings.ui.controller.BookingDetailsController.java

private void addRowNetEarnings(final Pane content, final BookingBean be) {
    final HBox box = new HBox();
    box.setSpacing(boxSpacing);/*from w  ww . j  av a  2s .  co  m*/
    box.setPadding(boxPadding);
    box.setAlignment(Pos.CENTER_LEFT);
    box.setFillHeight(true);
    final TextField grossEarningsExpression = new TextField(be.getGrossEarningsExpression());
    grossEarningsExpression.setPrefWidth(prefTextInputFieldWidth * 1.5);
    booking2GrossEarnings.put(be, grossEarningsExpression);
    final Text grossEarnings = new Text(decimalFormat.format(be.getGrossEarnings()));
    final TextFlow tf = new TextFlow(new Text("Gross Earnings: "), grossEarningsExpression, new Text(" = "),
            grossEarnings, new Text(""));
    box.getChildren().addAll(tf);
    if (be.getGrossEarnings() <= 0) {
        box.getStyleClass().addAll("warning", "warning-bg");
    }

    final HBox box2 = new HBox();
    box2.setSpacing(boxSpacing);
    box2.setPadding(boxPadding);
    box2.setAlignment(Pos.CENTER_LEFT);
    box2.setFillHeight(true);

    Text text = new Text("Amount received: ");
    TextField textField = new TextField();
    textField.setText(new NumberStringConverter().toString(be.getPaymentSoFar()));
    textField.setEditable(false);
    be.paymentSoFarProperty().addListener((c, o, n) -> {
        textField.setText(new NumberStringConverter().toString(n));
    });
    box2.getChildren().addAll(text, textField);
    content.getChildren().addAll(box, box2);

}

From source file:com.github.drbookings.ui.controller.BookingDetailsController.java

private void addRowFees(final Pane content, final BookingBean be) {
    final HBox box = new HBox();

    // configure box
    box.setSpacing(8);//from w w  w .j  a  v  a  2  s.  co m
    box.setPadding(boxPadding);
    box.setAlignment(Pos.CENTER);
    box.setFillHeight(true);

    // add cleaning fees
    final TextField cleaningFeesTextField = new TextField();
    Bindings.bindBidirectional(cleaningFeesTextField.textProperty(), be.cleaningFeesProperty(),
            new NumberStringConverter(decimalFormat));
    cleaningFeesTextField.setPrefWidth(prefTextInputFieldWidth);
    final TextFlow cleaningFeesTextFlow = new TextFlow(new Text("Cleaning Fees: "), cleaningFeesTextField,
            new Text(" "));
    box.getChildren().add(cleaningFeesTextFlow);

    // add cleaning costs

    final CleaningEntry ce = be.getCleaning();
    if (ce != null) {
        final TextField cleaningCostsTextField = new TextField();
        Bindings.bindBidirectional(cleaningCostsTextField.textProperty(), ce.cleaningCostsProperty(),
                new NumberStringConverter(decimalFormat));
        cleaningCostsTextField.setPrefWidth(prefTextInputFieldWidth);
        final TextFlow cleaningCostsTextFlow = new TextFlow(new Text("Cleaning Costs: "),
                cleaningCostsTextField, new Text(" "));
        box.getChildren().add(cleaningCostsTextFlow);
    } else {
        final TextField cleaningCostsTextField = new TextField("No Cleaning");
        cleaningCostsTextField.setEditable(false);
        cleaningCostsTextField.setPrefWidth(prefTextInputFieldWidth);
        final TextFlow cleaningCostsTextFlow = new TextFlow(new Text("Cleaning Costs: "),
                cleaningCostsTextField);
        cleaningCostsTextField.getStyleClass().add("warning");
        box.getChildren().add(cleaningCostsTextFlow);
    }

    // add service fees
    final TextField serviceFeesTextField = new TextField();
    Bindings.bindBidirectional(serviceFeesTextField.textProperty(), be.serviceFeeProperty(),
            new NumberStringConverter(decimalFormat));
    serviceFeesTextField.setPrefWidth(prefTextInputFieldWidth);
    final TextFlow serviceFeesAbsTextFlow = new TextFlow(new Text("Service Fees: "), serviceFeesTextField,
            new Text(" "));
    box.getChildren().add(serviceFeesAbsTextFlow);

    // add service fees percent
    final TextField serviceFeesPercentTextField = new TextField();
    Bindings.bindBidirectional(serviceFeesPercentTextField.textProperty(), be.serviceFeesPercentProperty(),
            new NumberStringConverter(decimalFormat));
    serviceFeesPercentTextField.setPrefWidth(prefTextInputFieldWidth);
    final TextFlow serviceFeesPercentTextFlow = new TextFlow(new Text("Service Fees: "),
            serviceFeesPercentTextField, new Text(" %"));

    box.getChildren().add(serviceFeesPercentTextFlow);

    // add box to parent
    content.getChildren().add(box);

}

From source file:AudioPlayer3.java

private Node createControlPanel() {
    final HBox hbox = new HBox();
    hbox.setAlignment(Pos.CENTER);/*from  w ww.j av  a 2s .  c o m*/
    hbox.setFillHeight(false);

    final Button playPauseButton = createPlayPauseButton();

    final Button seekStartButton = new Button();
    seekStartButton.setId("seekStartButton");
    seekStartButton.setOnAction(new EventHandler<ActionEvent>() {
        @Override
        public void handle(ActionEvent event) {
            seekAndUpdatePosition(Duration.ZERO);
        }
    });

    final Button seekEndButton = new Button();
    seekEndButton.setId("seekEndButton");
    seekEndButton.setOnAction(new EventHandler<ActionEvent>() {
        @Override
        public void handle(ActionEvent event) {
            final MediaPlayer mediaPlayer = songModel.getMediaPlayer();
            final Duration totalDuration = mediaPlayer.getTotalDuration();
            final Duration oneSecond = Duration.seconds(1);
            seekAndUpdatePosition(totalDuration.subtract(oneSecond));
        }
    });

    hbox.getChildren().addAll(seekStartButton, playPauseButton, seekEndButton);
    return hbox;
}

From source file:org.sleuthkit.autopsy.timeline.ui.AbstractTimelineChart.java

/**
 * Constructor/*from w  ww.  j av  a 2s . com*/
 *
 * @param controller The TimelineController for this view.
 */
protected AbstractTimelineChart(TimeLineController controller) {
    super(controller);
    Platform.runLater(() -> {
        VBox vBox = new VBox(getSpecificLabelPane(), getContextLabelPane());
        vBox.setFillWidth(false);
        HBox hBox = new HBox(getSpacer(), vBox);
        hBox.setFillHeight(false);
        setBottom(hBox);
        DoubleBinding spacerSize = getYAxis().widthProperty().add(getYAxis().tickLengthProperty())
                .add(getAxisMargin());
        getSpacer().minWidthProperty().bind(spacerSize);
        getSpacer().prefWidthProperty().bind(spacerSize);
        getSpacer().maxWidthProperty().bind(spacerSize);
    });

    createSeries();

    selectedNodes.addListener((ListChangeListener.Change<? extends NodeType> change) -> {
        while (change.next()) {
            change.getRemoved().forEach(node -> applySelectionEffect(node, false));
            change.getAddedSubList().forEach(node -> applySelectionEffect(node, true));
        }
    });

    //show tooltip text in status bar
    hoverProperty().addListener(
            hoverProp -> controller.setStatusMessage(isHover() ? getDefaultTooltip().getText() : ""));

}