Example usage for javafx.scene Scene getX

List of usage examples for javafx.scene Scene getX

Introduction

In this page you can find the example usage for javafx.scene Scene getX.

Prototype

public final double getX() 

Source Link

Usage

From source file:com.eviware.loadui.ui.fx.util.NodeUtils.java

public static Rectangle2D localToScreen(Node node, Scene scene) {
    Bounds selectableBounds = node.localToScene(node.getBoundsInLocal());

    return new Rectangle2D(selectableBounds.getMinX() + scene.getX() + scene.getWindow().getX(),
            selectableBounds.getMinY() + scene.getY() + scene.getWindow().getY(),
            node.getBoundsInLocal().getWidth(), node.getBoundsInLocal().getHeight());
}

From source file:org.pdfsam.ui.selection.LoadingStatusIndicator.java

/**
 * Show a password request right below the wrapped Control
 *///  w ww . j  ava  2 s . c  o  m
public void showPasswordRequest() {
    Scene scene = this.getScene();
    if (scene != null) {
        Window owner = scene.getWindow();
        if (owner != null && owner.isShowing()) {
            Point2D nodeCoord = this.localToScene(this.getWidth() / 2, this.getHeight() / 1.5);
            double anchorX = Math.round(owner.getX() + scene.getX() + nodeCoord.getX() + 2);
            double anchorY = Math.round(owner.getY() + scene.getY() + nodeCoord.getY() + 2);
            popup.showFor(descriptorProvider.getPdfDocumentDescriptor(), this, anchorX, anchorY);
        }
    }
}

From source file:ua.com.ecotep.debtprevention.VnaklController.java

@FXML
private void handleDocSelectorAction(ActionEvent event) {
    if (selCl == null) {
        AlertDialog.showSimpleMessage("?    .",
                AlertDialog.ICON_INFO, parentInterface.getCurrentWindow());
        return;//from   w  w  w.  ja v  a 2  s  . c o m
    }
    Task<Object> task = DPSession.getInstance().getTask();
    if ((task != null) && (task.isRunning())) {
        AlertDialog.showSimpleMessage(
                "?    ?, -? .",
                AlertDialog.ICON_FORBIDDEN, parentInterface.getCurrentWindow());
        return;
    }
    Scene sceneParent = parentInterface.getCurrentWindow().getScene();
    final Point2D windowCoord = new Point2D(sceneParent.getWindow().getX(), sceneParent.getWindow().getY());
    final Point2D sceneCoord = new Point2D(sceneParent.getX(), sceneParent.getY());
    final Point2D nodeCoord = addDocButton.localToScene(0.0, 0.0);
    final double coordX = Math.round(windowCoord.getX() + sceneCoord.getX() + nodeCoord.getX());
    final double coordY = Math
            .round(windowCoord.getY() + sceneCoord.getY() + nodeCoord.getY() + addDocButton.getHeight() + 6);

    try {
        selectorPopup = new Popup();
        selectorPopup.setAutoHide(true);
        selectorPopup.setAutoFix(true);
        selectorPopup.setHideOnEscape(true);

        FXMLLoader loader = new FXMLLoader();
        loader.setLocation(getClass().getResource("/fxml/DocSelectScene.fxml"));

        AnchorPane root = (AnchorPane) loader.load();
        DocSelectController controller = loader.getController();
        controller.setParentInterface(this);
        Scene scene = new Scene(root);
        scene.setFill(null);
        selectorPopup.getContent().add(root);

        selectorPopup.setX(coordX);
        selectorPopup.setY(coordY);
        selectorPopup.show(parentInterface.getCurrentWindow());

    } catch (IOException ex) {
        Logger.getLogger(MainController.class.getName()).log(Level.SEVERE, null, ex);
        AlertDialog.showSimpleMessage(
                "? ?    !",
                AlertDialog.ICON_ERROR, parentInterface.getCurrentWindow());
    }
}