/** * Sets the pseudo class when the given property is true */ public static void bindPseudoClass(@Nonnull Node node, @Nonnull PseudoClass pseudoClass, @Nonnull ObservableBooleanValue pseudoClassActive) { //set initially node.pseudoClassStateChanged(pseudoClass, pseudoClassActive.get()); //Update the pseudo class whenever the property changes pseudoClassActive.addListener((observable, oldValue, newValue) -> node.pseudoClassStateChanged(pseudoClass, newValue)); }
@Override protected boolean computeValue() { return source.get(); } };
ObservableBooleanValue hover = this.hoverProperty() .or(micTooltip.getScene().getRoot().hoverProperty()) .or(screenTooltip.getScene().getRoot().hoverProperty()); hover.addListener((obs, wasHovering, isNowHovering) -> showButtons(isNowHovering));
@Override public boolean getBoolean(Object holder) throws IllegalArgumentException, IllegalAccessException, InvocationTargetException { if (ObservableBooleanValue.class.isAssignableFrom(property.getType())) return ((ObservableBooleanValue)property.getObject(holder)).get(); return property.getBoolean(holder); }
ObservableBooleanValue colliding = Bindings.createBooleanBinding(new Callable<Boolean>() { @Override public Boolean call() throws Exception { return rect1.getBoundsInParent().intersects(rect2.getBoundsInParent()); } }, rect1.boundsInParentProperty(), rect2.boundsInParentProperty()); colliding.addListener(new ChangeListener<Boolean>() { @Override public void changed(ObservableValue<? extends Boolean> obs, Boolean oldValue, Boolean newValue) { if (newValue) { System.out.println("Colliding"); } else { System.out.println("Not colliding"); } } });
KeyFrame end ; if (expanded.get()) { start = new KeyFrame(Duration.ZERO, new KeyValue(leftCol.prefWidthProperty(), 100)); end = new KeyFrame(Duration.millis(250), new KeyValue(leftCol.prefWidthProperty(), 0));