本文整理汇总了Java中javafx.scene.Node.getScene方法的典型用法代码示例。如果您正苦于以下问题:Java Node.getScene方法的具体用法?Java Node.getScene怎么用?Java Node.getScene使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类javafx.scene.Node
的用法示例。
在下文中一共展示了Node.getScene方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: calculateTransformRelativeTo
import javafx.scene.Node; //导入方法依赖的package包/类
/**
* Calculates the {@link Transform Transformation} from children node coordinates to
* parent node coordinates.
* <p>
* {@code child} must be a direct or indirect child of {@code rootOfCalculation}.
*
* @param rootOfCalculation Any node in a scene graph
* @param child A direct/indirect child of rootOfCalculation
* @return A Transformation between coordinates of child and rootOfCalculation
*/
public static Transform calculateTransformRelativeTo(Node rootOfCalculation, Node child) {
if (child.getScene() == null) {
throw new IllegalStateException("Child is not displayed in any scene currently.");
}
if (child.getParent() == null) {
throw new IllegalStateException(
"rootOfCalculation is not in the scenegraph between root node and child.");
}
if (child == rootOfCalculation) {
return new Affine();
}
Transform parentTransform = calculateTransformRelativeTo(rootOfCalculation, child.getParent());
return child.getLocalToParentTransform().createConcatenation(parentTransform);
}
示例2: endSuppressionIfFocusLost
import javafx.scene.Node; //导入方法依赖的package包/类
private static void endSuppressionIfFocusLost(Node node) {
if (!node.isFocused() && node.getScene() != null && node.getScene().getFocusOwner() != node) {
node.pseudoClassStateChanged(FOCUS_SUPRESSED_PSEUDO_CLASS, false);
}
}
示例3: getScene
import javafx.scene.Node; //导入方法依赖的package包/类
/**
* Gets scene.
*
* @see javafx.scene.Scene
* @param event
* @return
*/
public Scene getScene(ActionEvent event) {
Node source = (Node) event.getSource();
Scene scene = source.getScene();
return scene;
}