Search in sources :

Example 1 with DatePicker

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

the class DatePickerDemo method start.

@Override
public void start(Stage stage) {
    FlowPane main = new FlowPane();
    main.setVgap(20);
    main.setHgap(20);
    DatePicker datePicker = new DatePicker();
    main.getChildren().add(datePicker);
    JFXDatePicker datePickerFX = new JFXDatePicker();
    main.getChildren().add(datePickerFX);
    datePickerFX.setPromptText("pick a date");
    JFXTimePicker blueDatePicker = new JFXTimePicker();
    blueDatePicker.setDefaultColor(Color.valueOf("#3f51b5"));
    blueDatePicker.setOverLay(true);
    main.getChildren().add(blueDatePicker);
    StackPane pane = new StackPane();
    pane.getChildren().add(main);
    StackPane.setMargin(main, new Insets(100));
    pane.setStyle("-fx-background-color:WHITE");
    final Scene scene = new Scene(pane, 400, 700);
    scene.getStylesheets().add(MainDemo.class.getResource("/resources/css/jfoenix-fonts.css").toExternalForm());
    scene.getStylesheets().add(MainDemo.class.getResource("/resources/css/jfoenix-design.css").toExternalForm());
    stage.setTitle("JFX Date Picker Demo");
    stage.setScene(scene);
    stage.show();
}
Also used : JFXDatePicker(com.jfoenix.controls.JFXDatePicker) Insets(javafx.geometry.Insets) FlowPane(javafx.scene.layout.FlowPane) DatePicker(javafx.scene.control.DatePicker) JFXDatePicker(com.jfoenix.controls.JFXDatePicker) Scene(javafx.scene.Scene) JFXTimePicker(com.jfoenix.controls.JFXTimePicker) StackPane(javafx.scene.layout.StackPane)

Example 2 with DatePicker

use of javafx.scene.control.DatePicker in project jgnash by ccavanaugh.

the class ControlsTest method start.

@Override
public void start(final Stage primaryStage) throws Exception {
    Engine engine = createEngine();
    Objects.requireNonNull(engine);
    ThemeManager.restoreLastUsedTheme();
    DecimalTextField decimalTextField = new DecimalTextField();
    DecimalTextField decimalTextField2 = new DecimalTextField();
    decimalTextField2.scaleProperty().set(4);
    primaryStage.setTitle("Controls Test");
    Button btn = new Button();
    btn.setText("getDecimal()");
    // Create the DatePicker.
    DatePicker datePicker = new DatePickerEx();
    datePicker.setOnAction(event -> {
        LocalDate date = datePicker.getValue();
        System.out.println("Selected date: " + date);
    });
    decimalTextField.decimalProperty().addListener((observable, oldValue, newValue) -> System.out.println("decimalTextField: " + newValue));
    decimalTextField2.decimalProperty().addListener((observable, oldValue, newValue) -> System.out.println("decimalTextField2: " + newValue));
    ObjectProperty<BigDecimal> decimal = new SimpleObjectProperty<>();
    decimalTextField2.decimalProperty().bindBidirectional(decimal);
    decimal.set(BigDecimal.TEN);
    btn.setOnAction(event -> {
        decimal.set(BigDecimal.ONE);
        System.out.println(decimalTextField2.getDecimal());
    });
    System.out.println(decimal.isBound());
    System.out.println(decimalTextField2.decimalProperty().isBound());
    TransactionNumberComboBox numberComboBox = new TransactionNumberComboBox();
    numberComboBox.accountProperty().set(engine.getAccountList().get(0));
    Button exceptionButton = new Button("Show Exception");
    exceptionButton.setOnAction(event -> StaticUIMethods.displayException(new Exception("Test exception")));
    SecurityComboBox securityComboBox = new SecurityComboBox();
    TextFieldEx textFieldEx = new TextFieldEx();
    PopOverButton popOverButton = new PopOverButton(new FontAwesomeLabel(FontAwesomeLabel.FAIcon.EXCHANGE));
    popOverButton.setContentNode(new DecimalTextField());
    VBox vBox = new VBox();
    vBox.getChildren().addAll(decimalTextField, decimalTextField2, datePicker, new AccountComboBox(), numberComboBox, btn, exceptionButton, securityComboBox, new TimePeriodComboBox(), textFieldEx, popOverButton);
    primaryStage.setScene(new Scene(vBox, 300, 420));
    primaryStage.getScene().getStylesheets().add(MainView.DEFAULT_CSS);
    primaryStage.getScene().getRoot().getStyleClass().addAll("form", "dialog");
    primaryStage.show();
    primaryStage.requestFocus();
}
Also used : DatePickerEx(jgnash.uifx.control.DatePickerEx) TextFieldEx(jgnash.uifx.control.TextFieldEx) TimePeriodComboBox(jgnash.uifx.control.TimePeriodComboBox) Scene(javafx.scene.Scene) LocalDate(java.time.LocalDate) BigDecimal(java.math.BigDecimal) IOException(java.io.IOException) SimpleObjectProperty(javafx.beans.property.SimpleObjectProperty) DecimalTextField(jgnash.uifx.control.DecimalTextField) FontAwesomeLabel(jgnash.resource.font.FontAwesomeLabel) AccountComboBox(jgnash.uifx.control.AccountComboBox) Button(javafx.scene.control.Button) PopOverButton(jgnash.uifx.control.PopOverButton) PopOverButton(jgnash.uifx.control.PopOverButton) DatePicker(javafx.scene.control.DatePicker) SecurityComboBox(jgnash.uifx.control.SecurityComboBox) TransactionNumberComboBox(jgnash.uifx.control.TransactionNumberComboBox) VBox(javafx.scene.layout.VBox) Engine(jgnash.engine.Engine)

Example 3 with DatePicker

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

the class JFXDatePickerBehavior method onAutoHide.

/**************************************************************************
     *                                                                        *
     * Mouse Events handling (when losing focus)                              *
     *                                                                        *
     *************************************************************************/
@Override
public void onAutoHide() {
    DatePicker datePicker = (DatePicker) getControl();
    JFXDatePickerSkin cpSkin = (JFXDatePickerSkin) datePicker.getSkin();
    cpSkin.syncWithAutoUpdate();
    if (!datePicker.isShowing())
        super.onAutoHide();
}
Also used : JFXDatePickerSkin(com.jfoenix.skins.JFXDatePickerSkin) DatePicker(javafx.scene.control.DatePicker)

Example 4 with DatePicker

use of javafx.scene.control.DatePicker in project SmartCity-Market by TechnionYP5777.

the class ManagePackagesTab method initialize.

@Override
public void initialize(URL location, ResourceBundle __) {
    barcodeEventHandler.register(this);
    barcodeTextField.textProperty().addListener((observable, oldValue, newValue) -> {
        if (!newValue.matches("\\d*"))
            barcodeTextField.setText(newValue.replaceAll("[^\\d]", ""));
        showScanCodePane(true);
        resetParams();
        searchCodeButton.setDisable(newValue.isEmpty());
    });
    editPackagesAmountSpinner.getStyleClass().add(Spinner.STYLE_CLASS_SPLIT_ARROWS_HORIZONTAL);
    editPackagesAmountSpinner.valueProperty().addListener((obs, oldValue, newValue) -> {
        if (newValue == null || newValue < 1)
            editPackagesAmountSpinner.getValueFactory().setValue(oldValue);
        enableRunTheOperationButton();
    });
    editPackagesAmountSpinner.focusedProperty().addListener((observable, oldValue, newValue) -> {
        if (newValue != null && !newValue) {
            editPackagesAmountSpinner.increment(0);
            enableRunTheOperationButton();
        }
    });
    final Callback<DatePicker, DateCell> dayCellFactory = new Callback<DatePicker, DateCell>() {

        @Override
        public DateCell call(final DatePicker __) {
            return new DateCell() {

                @Override
                public void updateItem(LocalDate item, boolean empty) {
                    super.updateItem(item, empty);
                    if (!item.isBefore(LocalDate.now()))
                        return;
                    setDisable(true);
                    setStyle("-fx-background-color: #EEEEEE;");
                }
            };
        }
    };
    datePicker.setDayCellFactory(dayCellFactory);
    datePicker.setValue(LocalDate.now());
    VBox vbox = new VBox();
    vbox.setPadding(new Insets(10, 50, 50, 50));
    vbox.setSpacing(10);
    datePickerForSmartCode = new JFXDatePicker();
    Label lbl = new Label("Choose Date");
    vbox.getChildren().addAll(lbl, datePickerForSmartCode);
    JFXPopup popup = new JFXPopup(vbox);
    showDatePickerBtn.setOnMouseClicked(e -> popup.show(showDatePickerBtn, PopupVPosition.TOP, PopupHPosition.LEFT));
    radioButtonContainerSmarcodeOperations.addRadioButtons(Arrays.asList(new RadioButton[] { printSmartCodeRadioButton, addPackageToStoreRadioButton, removePackageFromStoreRadioButton, removePackageFromWarhouseRadioButton }));
    radioButtonContainerBarcodeOperations.addRadioButtons(Arrays.asList(new RadioButton[] { addPakageToWarhouseRadioButton }));
    resetParams();
    showScanCodePane(true);
}
Also used : JFXDatePicker(com.jfoenix.controls.JFXDatePicker) JFXPopup(com.jfoenix.controls.JFXPopup) Callback(javafx.util.Callback) Insets(javafx.geometry.Insets) Label(javafx.scene.control.Label) DatePicker(javafx.scene.control.DatePicker) JFXDatePicker(com.jfoenix.controls.JFXDatePicker) RadioButton(javafx.scene.control.RadioButton) JFXRadioButton(com.jfoenix.controls.JFXRadioButton) DateCell(javafx.scene.control.DateCell) LocalDate(java.time.LocalDate) VBox(javafx.scene.layout.VBox)

Aggregations

DatePicker (javafx.scene.control.DatePicker)4 JFXDatePicker (com.jfoenix.controls.JFXDatePicker)2 LocalDate (java.time.LocalDate)2 Insets (javafx.geometry.Insets)2 Scene (javafx.scene.Scene)2 VBox (javafx.scene.layout.VBox)2 JFXPopup (com.jfoenix.controls.JFXPopup)1 JFXRadioButton (com.jfoenix.controls.JFXRadioButton)1 JFXTimePicker (com.jfoenix.controls.JFXTimePicker)1 JFXDatePickerSkin (com.jfoenix.skins.JFXDatePickerSkin)1 IOException (java.io.IOException)1 BigDecimal (java.math.BigDecimal)1 SimpleObjectProperty (javafx.beans.property.SimpleObjectProperty)1 Button (javafx.scene.control.Button)1 DateCell (javafx.scene.control.DateCell)1 Label (javafx.scene.control.Label)1 RadioButton (javafx.scene.control.RadioButton)1 FlowPane (javafx.scene.layout.FlowPane)1 StackPane (javafx.scene.layout.StackPane)1 Callback (javafx.util.Callback)1