Search in sources :

Example 1 with DoubleProperty

use of javafx.beans.property.DoubleProperty in project JFoenix by jfoenixadmin.

the class JFXSliderSkin method initAnimation.

private void initAnimation(Orientation orientation) {
    double thumbPos, thumbNewPos;
    DoubleProperty layoutProperty;
    if (orientation == Orientation.HORIZONTAL) {
        if (((JFXSlider) getSkinnable()).getIndicatorPosition() == IndicatorPosition.RIGHT) {
            thumbPos = thumb.getLayoutY() - thumb.getHeight();
            thumbNewPos = thumbPos - shifting;
        } else {
            thumbPos = thumb.getLayoutY() - animatedThumb.getHeight() / 2;
            thumbNewPos = thumb.getLayoutY() - animatedThumb.getHeight() - thumb.getHeight();
        }
        layoutProperty = animatedThumb.translateYProperty();
    } else {
        if (((JFXSlider) getSkinnable()).getIndicatorPosition() == IndicatorPosition.RIGHT) {
            thumbPos = thumb.getLayoutX() - thumb.getWidth();
            thumbNewPos = thumbPos - shifting;
        } else {
            thumbPos = thumb.getLayoutX() - animatedThumb.getWidth() / 2;
            thumbNewPos = thumb.getLayoutX() - animatedThumb.getWidth() - thumb.getWidth();
        }
        layoutProperty = animatedThumb.translateXProperty();
    }
    timeline = new Timeline(new KeyFrame(Duration.ZERO, new KeyValue(animatedThumb.scaleXProperty(), 0, Interpolator.EASE_BOTH), new KeyValue(animatedThumb.scaleYProperty(), 0, Interpolator.EASE_BOTH), new KeyValue(layoutProperty, thumbPos, Interpolator.EASE_BOTH)), new KeyFrame(Duration.seconds(0.2), new KeyValue(animatedThumb.scaleXProperty(), 1, Interpolator.EASE_BOTH), new KeyValue(animatedThumb.scaleYProperty(), 1, Interpolator.EASE_BOTH), new KeyValue(layoutProperty, thumbNewPos, Interpolator.EASE_BOTH)));
}
Also used : Timeline(javafx.animation.Timeline) KeyValue(javafx.animation.KeyValue) KeyFrame(javafx.animation.KeyFrame) DoubleProperty(javafx.beans.property.DoubleProperty)

Example 2 with DoubleProperty

use of javafx.beans.property.DoubleProperty in project FXyzLib by Birdasaur.

the class Text3DHelper method getArea.

private double getArea() {
    DoubleProperty res = new SimpleDoubleProperty();
    IntStream.range(0, list.size() - 1).forEach(i -> res.set(res.get() + list.get(i).crossProduct(list.get(i + 1)).z));
    return res.doubleValue() / 2d;
}
Also used : SimpleDoubleProperty(javafx.beans.property.SimpleDoubleProperty) DoubleProperty(javafx.beans.property.DoubleProperty) SimpleDoubleProperty(javafx.beans.property.SimpleDoubleProperty)

Example 3 with DoubleProperty

use of javafx.beans.property.DoubleProperty in project aima-java by aimacode.

the class IntegratedAppBuilder method getResultFor.

/**
	 * Creates a scene with menu bar and a scalable container pane,
	 * assigns it to the stage, and returns a controller instance containing
	 * user interface logic.
	 * @return A controller class (will seldom be used by the caller).
	 */
public IntegratedAppPaneCtrl getResultFor(Stage stage) {
    // create a pane, content is affected by scale
    final DoubleProperty scale = paneCtrl.scaleProperty();
    BorderPane appPane = new BorderPane();
    appPane.scaleXProperty().bind(scale);
    appPane.scaleYProperty().bind(scale);
    Pane appPaneContainer = new Pane();
    appPaneContainer.getChildren().add(appPane);
    appPane.prefWidthProperty().bind(appPaneContainer.widthProperty().divide(scale));
    appPane.prefHeightProperty().bind(appPaneContainer.heightProperty().divide(scale));
    appPane.translateXProperty().bind(appPaneContainer.widthProperty().subtract(appPane.prefWidthProperty()).divide(2));
    appPane.translateYProperty().bind(appPaneContainer.heightProperty().subtract(appPane.prefHeightProperty()).divide(2));
    paneCtrl.setContext(appPane, stage, title);
    BorderPane root = new BorderPane();
    root.setTop(menuBar);
    root.setCenter(appPaneContainer);
    stage.setScene(new Scene(root, sceneWidth, sceneHeight));
    // just in case, the builder is called twice...
    IntegratedAppPaneCtrl result = paneCtrl;
    paneCtrl = new IntegratedAppPaneCtrl();
    return result;
}
Also used : BorderPane(javafx.scene.layout.BorderPane) DoubleProperty(javafx.beans.property.DoubleProperty) Scene(javafx.scene.Scene) BorderPane(javafx.scene.layout.BorderPane) Pane(javafx.scene.layout.Pane)

Example 4 with DoubleProperty

use of javafx.beans.property.DoubleProperty in project Gargoyle by callakrsos.

the class PropertyChangeExam method setProperty.

public void setProperty(Node node, String name, Object value) {
    try {
        if (value == null)
            return;
        Method method = node.getClass().getMethod(name + "Property");
        if (method == null)
            return;
        method.setAccessible(true);
        Object fromPropertValue = method.invoke(node);
        if (Property.class.isAssignableFrom(fromPropertValue.getClass())) {
            if (WritableValue.class.isAssignableFrom(fromPropertValue.getClass())) {
                Method setMethod = null;
                if (fromPropertValue instanceof BooleanProperty || fromPropertValue instanceof DoubleProperty) {
                    setMethod = fromPropertValue.getClass().getMethod("setValue", Object.class);
                } else {
                    setMethod = fromPropertValue.getClass().getMethod("set", Object.class);
                }
                if (setMethod != null) {
                    setMethod.setAccessible(true);
                    if (value.getClass().isPrimitive()) {
                        setMethod.invoke(fromPropertValue, value.getClass());
                    } else {
                        setMethod.invoke(fromPropertValue, value);
                    }
                }
            } else {
            }
        } else {
            System.out.println(fromPropertValue);
        }
    } catch (Exception e) {
        System.out.println("error prop name : " + name + " value : " + value + " value type : " + value.getClass());
    // e.printStackTrace();
    }
}
Also used : BooleanProperty(javafx.beans.property.BooleanProperty) Method(java.lang.reflect.Method) DoubleProperty(javafx.beans.property.DoubleProperty)

Aggregations

DoubleProperty (javafx.beans.property.DoubleProperty)4 Method (java.lang.reflect.Method)1 KeyFrame (javafx.animation.KeyFrame)1 KeyValue (javafx.animation.KeyValue)1 Timeline (javafx.animation.Timeline)1 BooleanProperty (javafx.beans.property.BooleanProperty)1 SimpleDoubleProperty (javafx.beans.property.SimpleDoubleProperty)1 Scene (javafx.scene.Scene)1 BorderPane (javafx.scene.layout.BorderPane)1 Pane (javafx.scene.layout.Pane)1