Search in sources :

Example 1 with TextField

use of javafx.scene.control.TextField in project Smartcity-Smarthouse by TechnionYP5777.

the class MessageViewController method buildStreamModePane.

void buildStreamModePane() {
    streamFieldMap = new HashMap<>();
    int currentRow = 0;
    streamMode.add(new Label("Name"), 0, currentRow);
    streamMode.add(new Label("From"), 1, currentRow);
    streamMode.add(new Label("To"), 2, currentRow++);
    for (final SensorField ¢ : currentSensor.getFields()) {
        streamMode.add(new Label(¢.getName()), 0, currentRow);
        final List<Node> nodes = new ArrayList<>();
        if (¢.getType() == Types.BOOLEAN) {
            final ComboBox<BooleanValues> b = new ComboBox<>();
            b.getItems().addAll(BooleanValues.values());
            streamMode.add(b, 1, currentRow);
            nodes.add(b);
        } else {
            final TextField t1 = new TextField(), t2 = new TextField();
            streamMode.add(t1, 1, currentRow);
            nodes.add(t1);
            if (¢.getType() != Types.STRING) {
                streamMode.add(t2, 2, currentRow);
                nodes.add(t2);
            }
        }
        streamFieldMap.put(¢, nodes);
        ++currentRow;
    }
    streamMode.add(new Label("Send Interval(integer only):"), 0, currentRow);
    final TextField t1 = new TextField(), t2 = new TextField();
    streamMode.add(t1, 1, currentRow);
    streamMode.add(t2, 2, currentRow);
    timeInput = new Pair<>(t1, t2);
}
Also used : SensorField(il.ac.technion.cs.smarthouse.simulator.model.SensorField) ComboBox(javafx.scene.control.ComboBox) Node(javafx.scene.Node) Label(javafx.scene.control.Label) ArrayList(java.util.ArrayList) TextField(javafx.scene.control.TextField)

Example 2 with TextField

use of javafx.scene.control.TextField in project fxexperience2 by EricCanull.

the class ColorPickerControl method initialize.

/**
     * Private
     */
private void initialize() {
    final FXMLLoader loader = new FXMLLoader();
    //NOI18N
    loader.setLocation(ColorPickerControl.class.getResource("/fxml/FXMLColorPicker.fxml"));
    loader.setController(this);
    loader.setRoot(this);
    try {
        loader.load();
    } catch (IOException ex) {
        Logger.getLogger(ColorPickerControl.class.getName()).log(Level.SEVERE, null, ex);
    }
    assert hue_slider != null;
    assert picker_region != null;
    assert hue_textfield != null;
    assert saturation_textfield != null;
    assert brightness_textfield != null;
    assert alpha_textfield != null;
    assert red_textfield != null;
    assert green_textfield != null;
    assert blue_textfield != null;
    assert alpha_slider != null;
    // Make the grad for hue slider
    hue_slider.setStyle(makeHueSliderCSS());
    // Investigate why height + width listeners do not work
    // Indeed, the picker_handle_stackpane bounds may still be null at this point
    // UPDATE BELOW TO BE CALLED ONCE ONLY AT DISPLAY TIME
    picker_region.boundsInParentProperty().addListener((ov, oldb, newb) -> {
        picker_scrollpane.setHvalue(0.5);
        picker_scrollpane.setVvalue(0.5);
        // Init time only
        final Paint paint = paintPickerController.getPaintProperty();
        if (paint instanceof Color) {
            updateUI((Color) paint);
        } else if (paint instanceof LinearGradient || paint instanceof RadialGradient) {
            final GradientPicker gradientPicker = paintPickerController.getGradientPicker();
            final GradientPickerStop gradientPickerStop = gradientPicker.getSelectedStop();
            // Update the color preview with the color of the selected stop
            if (gradientPickerStop != null) {
                updateUI(gradientPickerStop.getColor());
            }
        }
    });
    final ChangeListener<Boolean> onHSBFocusedChange = (ov, oldValue, newValue) -> {
        if (newValue == false) {
            // Update UI
            final Color color = updateUI_OnHSBChange();
            // Update model
            setPaintProperty(color);
        }
    };
    final ChangeListener<Boolean> onRGBFocusedChange = (ov, oldValue, newValue) -> {
        if (newValue == false) {
            // Update UI
            final Color color = updateUI_OnRGBChange();
            // Update model
            setPaintProperty(color);
        }
    };
    final ChangeListener<Boolean> onHexaFocusedChange = (ov, oldValue, newValue) -> {
        if (newValue == false) {
            try {
                // Update UI
                final Color color = updateUI_OnHexaChange();
                // Update model
                setPaintProperty(color);
            } catch (IllegalArgumentException iae) {
                handleHexaException();
            }
        }
    };
    // TextField ON FOCUS LOST event handler
    hue_textfield.focusedProperty().addListener(onHSBFocusedChange);
    saturation_textfield.focusedProperty().addListener(onHSBFocusedChange);
    brightness_textfield.focusedProperty().addListener(onHSBFocusedChange);
    alpha_textfield.focusedProperty().addListener(onHSBFocusedChange);
    red_textfield.focusedProperty().addListener(onRGBFocusedChange);
    green_textfield.focusedProperty().addListener(onRGBFocusedChange);
    blue_textfield.focusedProperty().addListener(onRGBFocusedChange);
    hexa_textfield.focusedProperty().addListener(onHexaFocusedChange);
    // Slider ON VALUE CHANGE event handler
    hue_slider.valueProperty().addListener((ov, oldValue, newValue) -> {
        if (updating == true) {
            return;
        }
        double hue = newValue.doubleValue();
        // retrieve HSB TextFields values
        double saturation = Double.valueOf(saturation_textfield.getText()) / 100.0;
        double brightness = Double.valueOf(brightness_textfield.getText()) / 100.0;
        double alpha = Double.valueOf(alpha_textfield.getText());
        // Update UI
        final Color color = updateUI(hue, saturation, brightness, alpha);
        // Update model
        setPaintProperty(color);
    });
    alpha_slider.valueProperty().addListener((ov, oldValue, newValue) -> {
        if (updating == true) {
            return;
        }
        double alpha = newValue.doubleValue();
        // retrieve HSB TextFields values
        double hue = Double.valueOf(hue_textfield.getText());
        double saturation = Double.valueOf(saturation_textfield.getText()) / 100.0;
        double brightness = Double.valueOf(brightness_textfield.getText()) / 100.0;
        // Update UI
        final Color color = updateUI(hue, saturation, brightness, alpha);
        // Update model
        setPaintProperty(color);
    });
    final ChangeListener<Boolean> liveUpdateListener = (ov, oldValue, newValue) -> paintPickerController.setLiveUpdate(newValue);
    picker_region.pressedProperty().addListener(liveUpdateListener);
    hue_slider.pressedProperty().addListener(liveUpdateListener);
    alpha_slider.pressedProperty().addListener(liveUpdateListener);
}
Also used : Color(javafx.scene.paint.Color) TextField(javafx.scene.control.TextField) Mode(com.fxexperience.javafx.scene.control.paintpicker.PaintPicker.Mode) MouseEvent(javafx.scene.input.MouseEvent) IOException(java.io.IOException) StackPane(javafx.scene.layout.StackPane) LinearGradient(javafx.scene.paint.LinearGradient) GradientPickerStop(com.fxexperience.javafx.scene.control.gradientpicker.GradientPickerStop) Logger(java.util.logging.Logger) VBox(javafx.scene.layout.VBox) Level(java.util.logging.Level) FXML(javafx.fxml.FXML) PaintPickerController(com.fxexperience.javafx.scene.control.paintpicker.PaintPickerController) ActionEvent(javafx.event.ActionEvent) ScrollPane(javafx.scene.control.ScrollPane) Slider(javafx.scene.control.Slider) Region(javafx.scene.layout.Region) Paint(javafx.scene.paint.Paint) FXMLLoader(javafx.fxml.FXMLLoader) RadialGradient(javafx.scene.paint.RadialGradient) GradientPicker(com.fxexperience.javafx.scene.control.gradientpicker.GradientPicker) ChangeListener(javafx.beans.value.ChangeListener) Circle(javafx.scene.shape.Circle) Bounds(javafx.geometry.Bounds) Color(javafx.scene.paint.Color) RadialGradient(javafx.scene.paint.RadialGradient) IOException(java.io.IOException) Paint(javafx.scene.paint.Paint) FXMLLoader(javafx.fxml.FXMLLoader) GradientPickerStop(com.fxexperience.javafx.scene.control.gradientpicker.GradientPickerStop) GradientPicker(com.fxexperience.javafx.scene.control.gradientpicker.GradientPicker) LinearGradient(javafx.scene.paint.LinearGradient)

Example 3 with TextField

use of javafx.scene.control.TextField in project fxexperience2 by EricCanull.

the class ColorPickerControl method onHSBChange.

private void onHSBChange(ActionEvent event) {
    // Update UI
    final Color color = updateUI_OnHSBChange();
    final Object source = event.getSource();
    assert source instanceof TextField;
    ((TextField) source).selectAll();
    // Update model
    setPaintProperty(color);
}
Also used : Color(javafx.scene.paint.Color) TextField(javafx.scene.control.TextField)

Example 4 with TextField

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

the class LayerCell method createTextField.

private void createTextField() {
    textField = new TextField(getString());
    textField.setOnKeyReleased(new EventHandler<KeyEvent>() {

        @Override
        public void handle(KeyEvent t) {
            if (t.getCode() == KeyCode.ENTER) {
                commitEdit(textField.getText());
            } else if (t.getCode() == KeyCode.ESCAPE) {
                cancelEdit();
            }
        }
    });
}
Also used : KeyEvent(javafx.scene.input.KeyEvent) TextField(javafx.scene.control.TextField)

Example 5 with TextField

use of javafx.scene.control.TextField in project TeachingInSimulation by ScOrPiOzzy.

the class TextFieldCell method startEdit.

/**
 *************************************************************************
 * * Public API * *
 *************************************************************************
 */
@Override
public void startEdit() {
    if (!isEditable()) {
        return;
    }
    if (isEditing()) {
        if (textField == null) {
            textField = new TextField(getConverter().toString(getItem()));
        } else {
            textField.setText(getConverter().toString(getItem()));
        }
        this.setText(null);
        this.setGraphic(textField);
    }
}
Also used : TextField(javafx.scene.control.TextField)

Aggregations

TextField (javafx.scene.control.TextField)218 Label (javafx.scene.control.Label)98 Button (javafx.scene.control.Button)68 Insets (javafx.geometry.Insets)62 HBox (javafx.scene.layout.HBox)45 GridPane (javafx.scene.layout.GridPane)44 Scene (javafx.scene.Scene)42 VBox (javafx.scene.layout.VBox)34 InputTextField (bisq.desktop.components.InputTextField)32 Node (javafx.scene.Node)30 Stage (javafx.stage.Stage)27 List (java.util.List)26 ButtonType (javafx.scene.control.ButtonType)23 CheckBox (javafx.scene.control.CheckBox)23 Tooltip (javafx.scene.control.Tooltip)23 StackPane (javafx.scene.layout.StackPane)22 ArrayList (java.util.ArrayList)21 Dialog (javafx.scene.control.Dialog)21 BorderPane (javafx.scene.layout.BorderPane)19 ImageView (javafx.scene.image.ImageView)18