List of usage examples for javafx.scene Scene getWindow
public final Window getWindow()
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:com.bekwam.resignator.SettingsController.java
@FXML public void cancel(ActionEvent evt) { if (dirtyFlag) { Alert alert = new Alert(Alert.AlertType.CONFIRMATION, "Form has been modified"); alert.setHeaderText("Discard edits?"); Optional<ButtonType> response = alert.showAndWait(); if (response.isPresent() && response.get() == ButtonType.OK) { Configuration savedConf = configurationDS.getConfiguration(); if (logger.isDebugEnabled()) { logger.debug("[CANCEL] reverting configuration ac jdkhome={} to sc jjdkhome={}", activeConfiguration.getJDKHome(), savedConf.getJDKHome().get()); }/*from ww w . j a va2s . c o m*/ activeConfiguration.setJDKHome(savedConf.getJDKHome().get()); dirtyFlag = false; } else { return; // dirtyFlag continues to be true } } Scene scene = ((Button) evt.getSource()).getScene(); if (scene != null) { Window w = scene.getWindow(); if (w != null) { w.hide(); } } }
From source file:com.bekwam.examples.javafx.oldscores.ScoresDialogController.java
@FXML public void close(ActionEvent evt) { Scene scene = ((Button) evt.getSource()).getScene(); if (scene != null) { Window w = scene.getWindow(); if (w != null) { w.hide();/*from ww w.java2s . c o m*/ } } }
From source file:com.bekwam.resignator.JarsignerConfigController.java
@FXML public void close(ActionEvent evt) { if (logger.isDebugEnabled()) { logger.debug("[CLOSE]"); }// w w w .java 2 s .c om Scene scene = ((Button) evt.getSource()).getScene(); if (scene != null) { Window w = scene.getWindow(); if (w != null) { w.hide(); } } }
From source file:com.panemu.tiwulfx.control.skin.LookupFieldSkin.java
private void positionAndShowPopup() { if (getPopup().getSkin() == null) { getSkinnable().getScene().getRoot().impl_processCSS(true); }/*from w w w . ja v a 2 s . c o m*/ Point2D p = getPrefPopupPosition(); /** * In LookupColumn, sometimes the lookupfield disappears due to commit * editing before the popup appears. In this case, * lookupField.getScene() will be null. */ Scene scene = lookupField.getScene(); if (scene != null) { getPopup().show(scene.getWindow(), p.getX(), p.getY()); } }
From source file:io.bitsquare.gui.main.overlays.Overlay.java
protected void cleanup() { if (centerTime != null) centerTime.stop();//from w w w .j a v a 2s . c o m if (owner == null) owner = MainView.getRootContainer(); Scene rootScene = owner.getScene(); if (rootScene != null) { Window window = rootScene.getWindow(); if (window != null && positionListener != null) { window.xProperty().removeListener(positionListener); window.yProperty().removeListener(positionListener); window.widthProperty().removeListener(positionListener); } } }
From source file:io.bitsquare.gui.main.overlays.Overlay.java
protected void layout() { if (owner == null) owner = MainView.getRootContainer(); Scene rootScene = owner.getScene(); if (rootScene != null) { Window window = rootScene.getWindow(); double titleBarHeight = window.getHeight() - rootScene.getHeight(); if (Utilities.isWindows()) titleBarHeight -= 9;/*from ww w . ja v a2s .c o m*/ stage.setX(Math.round(window.getX() + (owner.getWidth() - stage.getWidth()) / 2)); if (type.animationType == AnimationType.SlideDownFromCenterTop) stage.setY(Math.round(window.getY() + titleBarHeight)); else stage.setY( Math.round(window.getY() + titleBarHeight + (owner.getHeight() - stage.getHeight()) / 2)); } }
From source file:io.bitsquare.gui.main.overlays.Overlay.java
public void display() { if (owner == null) owner = MainView.getRootContainer(); if (owner != null) { Scene rootScene = owner.getScene(); if (rootScene != null) { Scene scene = new Scene(gridPane); scene.getStylesheets().setAll(rootScene.getStylesheets()); scene.setFill(Color.TRANSPARENT); setupKeyHandler(scene);/*from w ww . java 2 s . c o m*/ stage = new Stage(); stage.setScene(scene); Window window = rootScene.getWindow(); setModality(); stage.initStyle(StageStyle.TRANSPARENT); stage.show(); layout(); addEffectToBackground(); // On Linux the owner stage does not move the child stage as it does on Mac // So we need to apply centerPopup. Further with fast movements the handler loses // the latest position, with a delay it fixes that. // Also on Mac sometimes the popups are positioned outside of the main app, so keep it for all OS positionListener = (observable, oldValue, newValue) -> { if (stage != null) { layout(); if (centerTime != null) centerTime.stop(); centerTime = UserThread.runAfter(this::layout, 3); } }; window.xProperty().addListener(positionListener); window.yProperty().addListener(positionListener); window.widthProperty().addListener(positionListener); animateDisplay(); } } }
From source file:org.pdfsam.ui.selection.LoadingStatusIndicator.java
/** * Show a password request right below the wrapped Control */// w w w . j a va2 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 ww w . ja v a2 s. co 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()); } }