@Override public Node getDisplayNode() { if (displayNode == null) { displayNode = getEditableInputNode(); displayNode.getStyleClass().add("date-picker-display-node"); updateDisplayNode(); } displayNode.setEditable(jfxDatePicker.isEditable()); return displayNode; }
@Override public Node getDisplayNode() { if (displayNode == null) { displayNode = getEditableInputNode(); displayNode.getStyleClass().add("time-picker-display-node"); updateDisplayNode(); } displayNode.setEditable(jfxTimePicker.isEditable()); return displayNode; }
BookmarksLevelComboBox() { validationSupport.setValidator(Validators.alwaysFalse()); setEditable(true); getSelectionModel().selectFirst(); valueProperty().addListener((o, oldVal, newVal) -> validate()); validationSupport.validationStateProperty().addListener(o -> { if (validationSupport.validationStateProperty().get() == ValidationState.INVALID) { getEditor().getStyleClass().addAll(Style.INVALID.css()); } else { getEditor().getStyleClass().removeAll(Style.INVALID.css()); } }); getEditor().focusedProperty().addListener((obs, old, isFocused) -> { // workaround for https://bugs.openjdk.java.net/browse/JDK-8136838 if (!isFocused) { String newVal = getEditor().getText(); if (nonNull(newVal) && !newVal.equals(getValue())) { setValue(newVal); } } }); }
public static void setupURITextField(TextField textField) { textField.textProperty().addListener((observable, oldValue, newValue) -> { if (newValue!=null){ try { URI uri = new URI(newValue); textField.getStyleClass().removeIf("error"::equals); } catch (URISyntaxException e) { textField.getStyleClass().add("error"); } } }); }
public static void setupLocalTimeTextField(TextField textField) { textField.textProperty().addListener((observable, oldValue, newValue) -> { if (newValue!=null){ try { TIME_FORMAT.parse(newValue); textField.getStyleClass().removeIf("error"::equals); } catch (DateTimeParseException e) { textField.getStyleClass().add("error"); } } }); } }
private void newInstance(boolean ispasswordField) { if (ispasswordField) { textField = new JFXPasswordField(); textField.getStyleClass().remove("custom-text-field"); textField.getStyleClass().remove("jfx-text-field"); } else { textField = new JFXTextField(); textField.getStyleClass().remove("custom-text-field"); //textField.getStyleClass().remove("jfx-text-field"); } }
@Override public void changed(ObservableValue<? extends String> observable, String oldValue, String newValue) { boolean parsed = true; Date date = null; if (newValue != null && !newValue.isEmpty()) { try { date = dateFormat.parse(newValue); } catch (ParseException e) { parsed = false; } } if (!parsed) { if (!textfield.getStyleClass().contains("error")) { textfield.getStyleClass().add("error"); } if (textfield.isFocused()) { setModelDate(null); } } else { textfield.getStyleClass().remove("error"); if (textfield.isFocused()) { setModelDate(date); } } } });
public static void setupLocalDateTextField(TextField textField) { textField.textProperty().addListener((observable, oldValue, newValue) -> { DateTimeFormatter dtf = new DateTimeFormatterBuilder().appendLocalized(FormatStyle.SHORT, null).toFormatter(Locale.getDefault()); if (newValue!=null){ try { dtf.parse(newValue); textField.getStyleClass().removeIf("error"::equals); } catch (DateTimeParseException e) { textField.getStyleClass().add("error"); } } }); }
@Override public Node getDisplayNode() { if (displayNode == null) { displayNode = reflectGetEditableInputNode(); displayNode.getStyleClass().add("date-picker-display-node"); reflectUpdateDisplayNode(); } displayNode.setEditable(jfxDatePicker.isEditable()); return displayNode; }
@Override public Node getDisplayNode() { if (displayNode == null) { displayNode = reflectGetEditableInputNode(); displayNode.getStyleClass().add("time-picker-display-node"); reflectUpdateDisplayNode(); } displayNode.setEditable(jfxTimePicker.isEditable()); return displayNode; }
/** * Creates a new {@link TextField} object fitted to the given container. * * @param container The container to which the text field is added * @return The created text field */ private TextField createTextField(AnchorPane container) { TextField searchField = new TextField(); searchField.getStyleClass().add("searchBar"); searchField.prefHeightProperty().bind(container.prefHeightProperty()); searchField.prefWidthProperty().bind(container.prefWidthProperty()); AnchorPane.setLeftAnchor(searchField, 0.0); AnchorPane.setRightAnchor(searchField, 0.0); return searchField; }
if (!newValue) { passwordKey.setTooltip(new Tooltip("Key is invalid")); if (passwordKey.getStyleClass().stream().noneMatch(c -> c.equals("error"))) passwordKey.getStyleClass().add("error"); } else { passwordKey.setTooltip(null); passwordKey.getStyleClass().remove("error");
public OpenPatricianWoodenTextInputSkin(OpenPatricianWoodenTextInput input) { super(input); textField = new TextField(input.getText()); imgView = new ImageView(); calculateDimensions(input); textField.textProperty().bindBidirectional(input.textProperty()); textField.getStyleClass().add("openPatricianWoodenTextInput"); Insets padding = textField.getPadding(); Insets newPadding = new Insets(0, padding.getRight(), 0, padding.getLeft()); textField.setPadding(newPadding); // Listeners input.sizeProperty().addListener((observable, oldValue, newValue) -> calculateDimensions(input)); textField.heightProperty().addListener((observable, oldValue, newValue) -> { Dimension2D dim = sizing.calculate(input.getSize(), input.getFont()); height.set(Math.max(dim.getHeight(), newValue.doubleValue())); setImage(); }); StackPane stack = new StackPane(); stack.getChildren().addAll(imgView, textField); Group group = new Group(stack); group.setManaged(false); getChildren().add(group); }
LocalTimeStringConverter localTimeStringConverter = new LocalTimeStringConverter(); textField.textProperty().addListener((observable, oldValue, newValue) -> { textField.getStyleClass().remove("error"); LocalTime localTime=null; try { } catch (DateTimeParseException e){ if (!Strings.isNullOrEmpty(newValue)){ textField.getStyleClass().add("error");
public OpenPatricianDialogInputSkin(OpenPatricianDialogInput input) { super(input); textField = new TextField(input.getText()); calculateDimensions(input); input.fontProperty().addListener((observable, oldValue, newValue) -> calculateDimensions(input)); textField.textProperty().bindBidirectional(input.textProperty()); textField.getStyleClass().add("openPatricianDialogInput"); Rectangle background = new Rectangle(); background.setHeight(height.doubleValue()); background.setWidth(width.doubleValue()); background.setFill(Color.rgb(150, 150, 150)); background.heightProperty().bind(height); background.widthProperty().bind(width); StackPane stack = new StackPane(); stack.getChildren().addAll(background, textField); Group group = new Group(stack); group.setManaged(false); getChildren().add(group); }
if (!newValue) { keyField.setTooltip(new Tooltip("Key is invalid")); if (keyField.getStyleClass().stream().noneMatch(c -> c.equals("error"))) keyField.getStyleClass().add("error"); } else { keyField.getStyleClass().remove("error");
textField.getStyleClass().add("openPatricianSpinner"); textField.setEditable(false);
private static void setupClearButtonField(TextField inputField, ObjectProperty<Node> rightProperty) { inputField.getStyleClass().add("clearable-field"); //$NON-NLS-1$
this.setContent(content); command.getStyleClass().add("consoleCommandType"); consolePane = new ScrollPane(console);