private void initialize() { this.getStyleClass().add(DEFAULT_STYLE_CLASS); try { editorProperty(); Field editorField = DatePicker.class.getDeclaredField("editor"); editorField.setAccessible(true); ReadOnlyObjectWrapper<TextField> editor = (ReadOnlyObjectWrapper<TextField>) editorField.get(this); final FakeFocusJFXTextField editorNode = new FakeFocusJFXTextField(); this.focusedProperty().addListener((obj, oldVal, newVal) -> { if (getEditor() != null) { editorNode.setFakeFocus(newVal); } }); editorNode.activeValidatorWritableProperty().bind(activeValidatorProperty()); editor.set(editorNode); } catch (NoSuchFieldException e) { } catch (IllegalAccessException e) { } }
public final ReadOnlyObjectProperty<TextField> editorProperty() { if (editor == null) { editor = new ReadOnlyObjectWrapper<>(this, "editor"); final FakeFocusJFXTextField editorNode = new FakeFocusJFXTextField(); this.focusedProperty().addListener((obj, oldVal, newVal) -> { if (getEditor() != null) { editorNode.setFakeFocus(newVal); } }); editorNode.activeValidatorWritableProperty().bind(activeValidatorProperty()); editor.set(editorNode); } return editor.getReadOnlyProperty(); }
private void initialize() { this.getStyleClass().add(DEFAULT_STYLE_CLASS); editorProperty(); ReadOnlyObjectWrapper<TextField> editor = ReflectionHelper.getFieldContent(DatePicker.class, this, "editor" ); final FakeFocusJFXTextField editorNode = new FakeFocusJFXTextField(); this.focusedProperty().addListener((obj, oldVal, newVal) -> { if (getEditor() != null) { editorNode.setFakeFocus(newVal); } }); editorNode.activeValidatorWritableProperty().bind(activeValidatorProperty()); editor.set(editorNode); }
public final ReadOnlyObjectProperty<TextField> editorProperty() { if (editor == null) { editor = new ReadOnlyObjectWrapper<>(this, "editor"); final FakeFocusJFXTextField editorNode = new FakeFocusJFXTextField(); this.focusedProperty().addListener((obj, oldVal, newVal) -> { if (getEditor() != null) { editorNode.setFakeFocus(newVal); } }); editorNode.activeValidatorWritableProperty().bind(activeValidatorProperty()); editor.set(editorNode); } return editor.getReadOnlyProperty(); }