本文整理匯總了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;
}