com.jfoenix.controls.JFXTimePicker Java Examples
The following examples show how to use
com.jfoenix.controls.JFXTimePicker.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: DatePickerDemo.java From JFoenix with Apache License 2.0 | 5 votes |
@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); final ObservableList<String> stylesheets = scene.getStylesheets(); stylesheets.addAll(MainDemo.class.getResource("/css/jfoenix-fonts.css").toExternalForm(), MainDemo.class.getResource("/css/jfoenix-design.css").toExternalForm()); stage.setTitle("JFX Date Picker Demo"); stage.setScene(scene); stage.show(); }
Example #2
Source File: JFXTimePickerBehavior.java From JFoenix with Apache License 2.0 | 5 votes |
/************************************************************************** * * * Mouse Events handling (when losing focus) * * * *************************************************************************/ @Override public void onAutoHide() { JFXTimePicker datePicker = (JFXTimePicker) getControl(); JFXTimePickerSkin cpSkin = (JFXTimePickerSkin) datePicker.getSkin(); cpSkin.syncWithAutoUpdate(); if (!datePicker.isShowing()) { super.onAutoHide(); } }
Example #3
Source File: MainScene.java From mars-sim with GNU General Public License v3.0 | 4 votes |
/** * Creates the earth time bar */ public void createEarthTimeBar() { if (masterClock == null) masterClock = sim.getMasterClock(); if (earthClock == null) earthClock = masterClock.getEarthClock(); datePickerFX = new JFXDatePicker(); datePickerFX.setValue(earthClock.getLocalDate()); datePickerFX.setEditable(false); // datePickerFX.setDefaultColor(Color.valueOf("#065185")); // datePickerFX.setOverLay(true); datePickerFX.setShowWeekNumbers(true); datePickerFX.setPromptText("Earth Date"); datePickerFX.setId("earth-time"); setQuickToolTip(datePickerFX, "Earth Date"); timePickerFX = new JFXTimePicker(); timePickerFX.setValue(earthClock.getLocalTime()); timePickerFX.setEditable(false); // timePickerFX.setDefaultColor(Color.valueOf("#065185")); // blueDatePicker.setOverLay(true); timePickerFX.setPromptText("Earth Time"); timePickerFX.setId("earth-time"); // timePickerFX.set24HourView(true); setQuickToolTip(timePickerFX, "Earth Time in UTC"); HBox box = new HBox(5, datePickerFX, timePickerFX); earthTimeBox = new HBox(box); earthTimeBox.setId("earth-time-box"); earthTimeBox.setAlignment(Pos.CENTER); if (OS.contains("linux")) { earthTimeBox.setPrefSize(50, 25); // 270 datePickerFX.setPrefSize(25, 25);// 160, 29); timePickerFX.setPrefSize(25, 25);// 140, 29); } else if (OS.contains("mac")) { earthTimeBox.setPrefSize(50, 23); // 230 datePickerFX.setPrefSize(23, 23); timePickerFX.setPrefSize(23, 23); } else { earthTimeBox.setPrefSize(50, 25); datePickerFX.setPrefSize(25, 25);// 130, 25); timePickerFX.setPrefSize(25, 25);// 110, 25); } }
Example #4
Source File: JFXTimePickerSkin.java From JFoenix with Apache License 2.0 | 4 votes |
@Override protected TextField getEditor() { return ((JFXTimePicker) getSkinnable()).getEditor(); }
Example #5
Source File: JFXTimePickerSkin.java From JFoenix with Apache License 2.0 | 4 votes |
@Override protected StringConverter<LocalTime> getConverter() { return ((JFXTimePicker) getSkinnable()).getConverter(); }
Example #6
Source File: JFXTimePickerContent.java From JFoenix with Apache License 2.0 | 4 votes |
JFXTimePickerContent(final JFXTimePicker jfxTimePicker) { this.timePicker = jfxTimePicker; LocalTime time = this.timePicker.getValue() == null ? LocalTime.now() : this.timePicker.getValue(); is24HourView = this.timePicker.is24HourView(); this.timePicker.valueProperty().addListener((o, oldVal, newVal) -> goToTime(newVal)); getStyleClass().add("date-picker-popup"); // create the header pane getChildren().add(createHeaderPane(time, is24HourView)); VBox contentHolder = new VBox(); // create content pane contentHolder.getChildren().add(createContentPane(time, is24HourView)); calendarPlaceHolder.getChildren().add(contentHolder); Rectangle clip = new Rectangle(); clip.widthProperty().bind(calendarPlaceHolder.widthProperty()); clip.heightProperty().bind(calendarPlaceHolder.heightProperty()); calendarPlaceHolder.setClip(clip); StackPane contentPlaceHolder = new StackPane(calendarPlaceHolder); getChildren().add(contentPlaceHolder); // add listeners unit.addListener((o, oldVal, newVal) -> { if (newVal == TimeUnit.HOURS) { angle.set(Math.toDegrees(2 * Math.PI / 12)); int tmp = Integer.parseInt(selectedHourLabel.getText()); if (is24HourView) { if (tmp == 0 || tmp > 12) { hoursContent.getChildren().get(0).setVisible(false); hoursContent.getChildren().get(1).setVisible(true); } else { hoursContent.getChildren().get(1).setVisible(false); hoursContent.getChildren().get(0).setVisible(true); } } pointerRotate.set(_24HourHoursPointerRotate); _24HourPointerRotate.set(_24HourHoursPointerRotate); timeLabel.set(selectedHourLabel); } else if (newVal == TimeUnit.MINUTES) { angle.set(Math.toDegrees(2 * Math.PI / 60)); pointerRotate.set(minsPointerRotate); timeLabel.set(selectedMinLabel); } swapLabelsColor(selectedHourLabel, selectedMinLabel); switchTimeUnit(newVal); }); if (!is24HourView) { period.addListener((o, oldVal, newVal) -> { swapLabelsColor(periodPMLabel, periodAMLabel); updateValue(); }); } }
Example #7
Source File: JFXTimePickerBehavior.java From JFoenix with Apache License 2.0 | 2 votes |
/*************************************************************************** * * * Constructors * * * **************************************************************************/ public JFXTimePickerBehavior(final JFXTimePicker timePicker) { super(timePicker, JFX_TIME_PICKER_BINDINGS); }