Package jfxtras.scene.control

Examples of jfxtras.scene.control.CalendarTextField


      };
      // POJO binding magic...
      personPA.bindBidirectional(path, tf.textProperty());
      ctrl = tf;
    } else if (controlType == CalendarTextField.class) {
      final CalendarTextField ctf = new CalendarTextField();
      personPA.bindBidirectional(path, ctf.calendarProperty(),
          Calendar.class);
      ctrl = ctf;
    } else if (controlType == ListSpinner.class) {
      final ListSpinner<T> ls = new ListSpinner<>(choices)
          .withCyclic(true);
View Full Code Here


        final BigDecimalField disabledField = new BigDecimalField();
        disabledField.setDisable(true);
        root.addRow(rowIndex++, new Label("disabled field"), disabledField);
        root.addRow(rowIndex++, new Label("regular TextField"), new TextField("1.000,1234"));
        root.addRow(rowIndex++, new Label("with promptText"), promptText);
        CalendarTextField calendarTextField = new CalendarTextField();
        root.addRow(rowIndex++, new Label("CalendarTextField"), calendarTextField);
        ComboBox<Locale> cmbLocales = new ComboBox<>(FXCollections.observableArrayList(Locale.GERMANY, Locale.UK, Locale.FRANCE));
        cmbLocales.setOnAction(event -> {
            dateFormatProperty.set(DateFormat.getDateInstance(DateFormat.MEDIUM, cmbLocales.getValue()));
            numberFormatProperty.set(NumberFormat.getNumberInstance(cmbLocales.getValue()));
        });
        root.addRow(rowIndex++, new Label("Locale"), cmbLocales);

        root.addRow(rowIndex++, new Label("Field with boundaries (0,100%)"),
                BigDecimalFieldBuilder.create()
                        .number(new BigDecimal("0.1"))
                        .minValue(BigDecimal.ZERO)
                        .maxValue(BigDecimal.ONE)
                        .stepwidth(new BigDecimal("0.01"))
                        .format(DecimalFormat.getPercentInstance())
                        .build()
        );

        promptText.numberProperty().addListener(new ChangeListener<BigDecimal>() {
            @Override
            public void changed(ObservableValue<? extends BigDecimal> observableValue, BigDecimal o, BigDecimal o1) {
                System.out.println(o1);
            }
        });

        Button button = new Button("Reset fields");
        button.setOnAction((ActionEvent event) -> {
            defaultSpinner.setNumber(new BigDecimal(Math.random() * 1000));
            decimalFormat.setNumber(new BigDecimal(Math.random() * 1000));
            percent.setNumber(new BigDecimal(Math.random()));
            localizedCurrency.setNumber(new BigDecimal(Math.random() * 1000));
            disabledField.setNumber(new BigDecimal(Math.random() * 1000));
            promptText.setNumber(null);
            calendarTextField.setCalendar(Calendar.getInstance());
            decimalFormat.requestFocus();
        });
        root.addRow(rowIndex++, new Label(), button);
        BigDecimalLabel bigDecimalLabel = new BigDecimalLabel();
        bigDecimalLabel.numberProperty().bind(defaultSpinner.numberProperty());
        bigDecimalLabel.formatProperty().bind(numberFormatProperty);
        root.addRow(rowIndex++, new Label("BigDecimalLabel"), bigDecimalLabel);

        CalendarLabel calendarLabel = new CalendarLabel();
        calendarLabel.valueProperty().bind(calendarTextField.calendarProperty());
        calendarLabel.formatProperty().bind(dateFormatProperty);
        root.addRow(rowIndex++, new Label("CalendarLabel"), calendarLabel);
//        defaultSpinner.requestFocus();
//        calendarTextField.requestFocus();
        Platform.runLater(new Runnable() {
View Full Code Here

TOP

Related Classes of jfxtras.scene.control.CalendarTextField

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.