java.lang.Object
com.dlsc.unitfx.util.ControlsUtil
public final class ControlsUtil extends Object
Utility methods for JavaFX controls.
-
Method Summary
Modifier and Type Method Description static voidbindBooleanToPseudoclass(javafx.scene.Node node, javafx.beans.value.ObservableValue<Boolean> booleanProperty, javafx.css.PseudoClass pseudoClass)Binds a boolean property to a pseudo class.static voidbindBooleanToStyleClass(javafx.scene.Node node, javafx.beans.value.ObservableValue<Boolean> booleanProperty, String styleClass)Binds a boolean property to a style class in the given node.static javafx.geometry.Point2DcalculatePointOnCircle(javafx.geometry.Point2D middle, double radius, double angle)Calculates the x,y position of the given angle in relation with the circle represented by the middle point and radius.static doubledistance(double alpha, double beta)Calculates the distance between two angles in degrees, the result is a number between 0 - 180.static doublerotation(double alpha, double beta)Calculates the rotation, which means the signed distance between two angles.
-
Method Details
-
bindBooleanToStyleClass
public static void bindBooleanToStyleClass(javafx.scene.Node node, javafx.beans.value.ObservableValue<Boolean> booleanProperty, String styleClass)Binds a boolean property to a style class in the given node. Doing this the style class is switched on/off depending on the boolean property.- Parameters:
node- The node which the style class will be applied to.booleanProperty- The flag to switch on/off.styleClass- The style class to be applied.
-
bindBooleanToPseudoclass
public static void bindBooleanToPseudoclass(javafx.scene.Node node, javafx.beans.value.ObservableValue<Boolean> booleanProperty, javafx.css.PseudoClass pseudoClass)Binds a boolean property to a pseudo class. Doing this the pseudo class is switched on/off in the given node.- Parameters:
node- The node which the pseudo class will be applied to.booleanProperty- The flag to switch on/off.pseudoClass- The style class to be applied.
-
distance
public static double distance(double alpha, double beta)Calculates the distance between two angles in degrees, the result is a number between 0 - 180.- Parameters:
alpha- The initial angle.beta- The final angle.- Returns:
- The distance between the angles.
-
rotation
public static double rotation(double alpha, double beta)Calculates the rotation, which means the signed distance between two angles.- Parameters:
alpha- The initial angle.beta- The final angle.- Returns:
- The rotation between the angles.
-
calculatePointOnCircle
public static javafx.geometry.Point2D calculatePointOnCircle(javafx.geometry.Point2D middle, double radius, double angle)Calculates the x,y position of the given angle in relation with the circle represented by the middle point and radius.- Parameters:
middle- The middle of the circle in pixel representation.radius- The radius of the circle.angle- The angle for which the point is going to be calculated.- Returns:
- The point calculated.
-