Search in sources :

Example 11 with CheckBox

use of javafx.scene.control.CheckBox in project trex-stateless-gui by cisco-system-traffic-generator.

the class MultiplierView method buildUI.

/**
     * Build UI
     */
private void buildUI() {
    // add slider area
    addLabel("Bandwidth", 7, 336);
    addLabel("0", 22, 287);
    addLabel("100", 22, 454);
    slider = new Slider(0, 100, 1);
    slider.setDisable(true);
    getChildren().add(slider);
    MultiplierView.setTopAnchor(slider, 22d);
    MultiplierView.setLeftAnchor(slider, 304d);
    slider.valueProperty().addListener(new ChangeListener<Number>() {

        @Override
        public void changed(ObservableValue<? extends Number> observable, Number oldValue, Number newValue) {
            // check min value for slider
            if ((double) newValue < MultiplierType.percentage.getMinRate(rate)) {
                slider.setValue(MultiplierType.percentage.getMinRate(rate));
            }
            updateOptionsValues(slider.getValue(), updateAll);
            if (fireUpdateCommand) {
                optionValueChangeHandler.optionValueChanged();
            }
        }
    });
    // add separator
    Separator separator = new Separator(Orientation.HORIZONTAL);
    separator.setPrefHeight(1);
    getChildren().add(separator);
    MultiplierView.setTopAnchor(separator, 50d);
    MultiplierView.setLeftAnchor(separator, 15d);
    MultiplierView.setRightAnchor(separator, 15d);
    group = new ToggleGroup();
    int index = 0;
    double prevComponentWidth = 0;
    AnchorPane optionContainer = new AnchorPane();
    getChildren().add(optionContainer);
    MultiplierView.setTopAnchor(optionContainer, 51d);
    MultiplierView.setLeftAnchor(optionContainer, 15d);
    MultiplierView.setRightAnchor(optionContainer, 150d);
    for (MultiplierType type : MultiplierType.values()) {
        MultiplierOption option = new MultiplierOption(type.getTitle(), group, type, this);
        option.setMultiplierSelectionEvent(this);
        optionContainer.getChildren().add(option);
        double leftSpace = prevComponentWidth + (index * 15);
        MultiplierView.setLeftAnchor(option, leftSpace);
        MultiplierView.setTopAnchor(option, 0d);
        MultiplierView.setBottomAnchor(option, 0d);
        multiplierOptionMap.put(type, option);
        index++;
        prevComponentWidth += option.getComponentWidth();
    }
    multiplierOptionMap.get(MultiplierType.pps).setSelected();
    // add suration
    Separator vSeparator = new Separator(Orientation.VERTICAL);
    vSeparator.setPrefWidth(1);
    getChildren().add(vSeparator);
    MultiplierView.setTopAnchor(vSeparator, 93d);
    MultiplierView.setLeftAnchor(vSeparator, 560d);
    MultiplierView.setBottomAnchor(vSeparator, 15d);
    addLabel("Duration", 70, 606);
    durationCB = new CheckBox();
    getChildren().add(durationCB);
    MultiplierView.setTopAnchor(durationCB, 94d);
    MultiplierView.setLeftAnchor(durationCB, 581d);
    MultiplierView.setBottomAnchor(durationCB, 20d);
    durationTF = new TextField("0");
    durationTF.setPrefSize(70, 22);
    durationTF.setDisable(true);
    getChildren().add(durationTF);
    MultiplierView.setTopAnchor(durationTF, 93d);
    MultiplierView.setLeftAnchor(durationTF, 606d);
    MultiplierView.setBottomAnchor(durationTF, 15d);
    durationTF.disableProperty().bind(durationCB.selectedProperty().not());
    durationTF.setTextFormatter(Util.getNumberFilter(4));
}
Also used : Slider(javafx.scene.control.Slider) MultiplierOption(com.exalttech.trex.ui.components.MultiplierOption) MultiplierType(com.exalttech.trex.ui.MultiplierType) CheckBox(javafx.scene.control.CheckBox) ToggleGroup(javafx.scene.control.ToggleGroup) TextField(javafx.scene.control.TextField) AnchorPane(javafx.scene.layout.AnchorPane) Separator(javafx.scene.control.Separator)

Example 12 with CheckBox

use of javafx.scene.control.CheckBox in project JFoenix by jfoenixadmin.

the class JFXCheckBoxSkin method layoutChildren.

@Override
protected void layoutChildren(final double x, final double y, final double w, final double h) {
    final CheckBox checkBox = getSkinnable();
    boxWidth = snapSize(container.prefWidth(-1));
    boxHeight = snapSize(container.prefHeight(-1));
    final double computeWidth = Math.min(checkBox.prefWidth(-1), checkBox.minWidth(-1)) + labelOffset + 2 * padding;
    final double labelWidth = Math.min(computeWidth - boxWidth, w - snapSize(boxWidth)) + labelOffset + 2 * padding;
    final double labelHeight = Math.min(checkBox.prefHeight(labelWidth), h);
    maxHeight = Math.max(boxHeight, labelHeight);
    final double xOffset = computeXOffset(w, labelWidth + boxWidth, checkBox.getAlignment().getHpos()) + x;
    final double yOffset = computeYOffset(h, maxHeight, checkBox.getAlignment().getVpos()) + x;
    if (invalid) {
        transition = new CheckBoxTransition();
        createFillTransition();
        if (getSkinnable().isSelected()) {
            playSelectAnimation(true);
        }
        invalid = false;
    }
    layoutLabelInArea(xOffset + boxWidth, yOffset, labelWidth, maxHeight, checkBox.getAlignment());
    container.resize(boxWidth, boxHeight);
    positionInArea(container, xOffset, yOffset, boxWidth, maxHeight, 0, checkBox.getAlignment().getHpos(), checkBox.getAlignment().getVpos());
}
Also used : CheckBox(javafx.scene.control.CheckBox) JFXCheckBox(com.jfoenix.controls.JFXCheckBox)

Example 13 with CheckBox

use of javafx.scene.control.CheckBox in project DistributedFractalNetwork by Budder21.

the class LayerBox method display.

public static MetaLayer display(TreeItem<MetaLayer> t) {
    Stage window = new Stage();
    //Block events to other windows
    window.initModality(Modality.APPLICATION_MODAL);
    window.setTitle("Edit Layer");
    window.setMinWidth(250);
    window.setMinHeight(200);
    VBox layout = new VBox(10);
    Label name = new Label();
    name.setText("Enter Name of Layer:");
    TextField nameIn = new TextField();
    nameIn.setPromptText("Layer Name");
    nameIn.minWidthProperty().bind(window.minWidthProperty().divide(2));
    nameIn.maxWidthProperty().bind(window.minWidthProperty().multiply(.75));
    Label type = new Label();
    type.setText("Select a Layer Type:");
    ChoiceBox typeIn = new ChoiceBox();
    typeIn.getItems().addAll(Layer.getLayerTypes());
    typeIn.minWidthProperty().bind(window.minWidthProperty().divide(2));
    typeIn.maxWidthProperty().bind(window.minWidthProperty().multiply(.75));
    typeIn.getSelectionModel().selectFirst();
    HBox hbox = new HBox();
    Button closeButton = new Button("Submit");
    closeButton.setOnAction(e -> window.close());
    CheckBox delete = new CheckBox("Delete");
    Canvas spacer = new Canvas();
    spacer.setWidth(30);
    Canvas push = new Canvas();
    push.setWidth(50);
    hbox.getChildren().addAll(push, closeButton, spacer, delete);
    layout.getChildren().addAll(name, nameIn, type, typeIn, hbox);
    layout.setAlignment(Pos.CENTER);
    if (((MetaLayer) t.getValue()).getName() != null)
        nameIn.setText(((MetaLayer) t.getValue()).getName());
    if (((MetaLayer) t.getValue()).getType() != null) {
        typeIn.getSelectionModel().select(((MetaLayer) t.getValue()).getType());
    }
    //Display window and wait for it to be closed before returning
    Scene scene = new Scene(layout);
    window.setScene(scene);
    window.showAndWait();
    if (delete.isSelected())
        return new MetaLayer("DELETE", "DELETE", true);
    return new MetaLayer(nameIn.getText(), typeIn.getSelectionModel().getSelectedItem().toString());
}
Also used : HBox(javafx.scene.layout.HBox) Button(javafx.scene.control.Button) CheckBox(javafx.scene.control.CheckBox) Canvas(javafx.scene.canvas.Canvas) Label(javafx.scene.control.Label) Stage(javafx.stage.Stage) TextField(javafx.scene.control.TextField) Scene(javafx.scene.Scene) VBox(javafx.scene.layout.VBox) ChoiceBox(javafx.scene.control.ChoiceBox)

Example 14 with CheckBox

use of javafx.scene.control.CheckBox in project POL-POM-5 by PlayOnLinux.

the class StepRepresentationLicence method drawStepContent.

@Override
protected void drawStepContent() {
    super.drawStepContent();
    TextArea licenceWidget = new TextArea(licenceText);
    licenceWidget.setLayoutX(10);
    licenceWidget.setLayoutY(100);
    licenceWidget.setMinWidth(700);
    licenceWidget.setMaxWidth(700);
    licenceWidget.setMinHeight(308);
    licenceWidget.setMaxHeight(308);
    licenceWidget.setEditable(false);
    CheckBox confirmWidget = new CheckBox(tr("I agree"));
    confirmWidget.setOnAction(event -> {
        isAgree = !isAgree;
        confirmWidget.setSelected(isAgree);
        setNextButtonEnabled(isAgree);
    });
    confirmWidget.setLayoutX(10);
    confirmWidget.setLayoutY(418);
    setNextButtonEnabled(false);
    this.addToContentPane(licenceWidget);
    this.addToContentPane(confirmWidget);
}
Also used : TextArea(javafx.scene.control.TextArea) CheckBox(javafx.scene.control.CheckBox)

Example 15 with CheckBox

use of javafx.scene.control.CheckBox in project POL-POM-5 by PlayOnLinux.

the class UserInterfacePanel method populate.

private void populate() {
    this.title = new TextWithStyle(tr("User Interface Settings"), "title");
    this.themeGrid = new GridPane();
    this.themeGrid.getStyleClass().add("grid");
    this.themeGrid.setHgap(20);
    this.themeGrid.setVgap(10);
    // Change Theme
    this.themeTitle = new TextWithStyle(tr("Theme:"), "captionTitle");
    this.themes = new ComboBox<>();
    this.themes.getItems().setAll(Themes.all());
    this.themes.setValue(Themes.fromShortName(settingsManager.getTheme()).orElse(Themes.DEFAULT));
    this.themes.setOnAction(event -> {
        this.handleThemeChange();
        this.save();
    });
    // View Script Sources
    this.showScriptSource = new CheckBox();
    this.showScriptSource.setSelected(settingsManager.isViewScriptSource());
    this.showScriptSource.setOnAction(event -> this.save());
    this.showScriptDescription = new Label(tr("Select, if you want to view the source repository of the scripts"));
    // Scale UI
    this.scale = new Slider(8, 16, settingsManager.getScale());
    this.scaleDescription = new Label(tr("Scale the user interface."));
    this.scale.valueProperty().addListener((observableValue, oldValue, newValue) -> {
        this.pause.setOnFinished(event -> {
            getScene().getRoot().setStyle(String.format("-fx-font-size: %.2fpt;", newValue));
            this.save();
        });
        this.pause.playFromStart();
    });
    this.themeGrid.add(themeTitle, 0, 0);
    this.themeGrid.add(themes, 1, 0);
    this.themeGrid.add(showScriptSource, 0, 1);
    this.themeGrid.add(showScriptDescription, 1, 1);
    this.themeGrid.add(scale, 0, 2);
    this.themeGrid.add(scaleDescription, 1, 2);
}
Also used : TextWithStyle(org.phoenicis.javafx.views.common.TextWithStyle) GridPane(javafx.scene.layout.GridPane) Slider(javafx.scene.control.Slider) CheckBox(javafx.scene.control.CheckBox) Label(javafx.scene.control.Label)

Aggregations

CheckBox (javafx.scene.control.CheckBox)19 Label (javafx.scene.control.Label)5 TextField (javafx.scene.control.TextField)5 Insets (javafx.geometry.Insets)4 JFXCheckBox (com.jfoenix.controls.JFXCheckBox)3 Button (javafx.scene.control.Button)3 TextArea (javafx.scene.control.TextArea)3 ObservableValue (javafx.beans.value.ObservableValue)2 Scene (javafx.scene.Scene)2 Slider (javafx.scene.control.Slider)2 AnchorPane (javafx.scene.layout.AnchorPane)2 FlowPane (javafx.scene.layout.FlowPane)2 HBox (javafx.scene.layout.HBox)2 MultiplierType (com.exalttech.trex.ui.MultiplierType)1 MultiplierOption (com.exalttech.trex.ui.components.MultiplierOption)1 TextFieldTableViewCell (com.exalttech.trex.ui.components.TextFieldTableViewCell)1 Alert (io.bitsquare.alert.Alert)1 InputTextField (io.bitsquare.gui.components.InputTextField)1 Popup (io.bitsquare.gui.main.overlays.popups.Popup)1 FormBuilder.addCheckBox (io.bitsquare.gui.util.FormBuilder.addCheckBox)1