Package javafx.stage

Examples of javafx.stage.Window


     * If possible, centers on the parent.
     * @param stage
     * @param parent
     */
    private void sizeReasonably(Stage stage, Node parent) {
      Window window = JuFxUtils.getWindow(parent);
     
      // Get the preferred size of the stage
      Rectangle2D prefRect = new Rectangle2D(stage.getX(), stage.getY(), stage.getWidth(), stage.getHeight());
      Rectangle2D parentBounds = window != null
        ? new Rectangle2D(window.getX(), window.getY(), window.getWidth(), window.getHeight())
        : null;

      Rectangle2D rect = this.getReasonableSize(prefRect, parentBounds);
     
      stage.setX(rect.getMinX());
View Full Code Here


   * @param node Node in the window
   * @return True if the window could be closed
   */
  public static boolean closeWindow(Node node) {
    if (node != null && node.getScene() != null) {
      Window window = node.getScene().getWindow();
      if (window instanceof Stage) {
        ((Stage) window).close();
        return true;
      } else if (window instanceof EmbeddedWindow) {
        window.getScene().getRoot().setVisible(false);
      }
    }
    return false;
  }
View Full Code Here

        }
        return 2;
    }

    private boolean isOwnerOf(Window window, Window targetWindow) {
        Window ownerWindow = retrieveOwnerOf(window);
        if (ownerWindow == targetWindow) {
            return true;
        }
        return ownerWindow != null && isOwnerOf(ownerWindow, targetWindow);
    }
View Full Code Here

    }

    @Override
    public Bounds boundsOnScreenFor(Scene scene) {
        Bounds windowBounds = boundsInWindowFor(scene);
        Window window = scene.getWindow();
        return translateBounds(windowBounds, window.getX(), window.getY());
    }
View Full Code Here

    }

    @Override
    public Bounds boundsOnScreenFor(Bounds boundsInScene, Scene scene) {
        Bounds windowBounds = boundsInWindowFor(boundsInScene, scene);
        Window window = scene.getWindow();
        return translateBounds(windowBounds, window.getX(), window.getY());
    }
View Full Code Here

    public String getText(final T control) {
        return new GetAction<String>() {

            @Override
            public void run(Object... parameters) {
                Window window = control.getWindow();
                setResult((window instanceof Stage)
                        ? ((Stage) window).getTitle() : null);
            }
        }.dispatch(Environment.getEnvironment());
    }
View Full Code Here

                            return super.check(control) && (control.getScene() == scene);
                        }
                    }).wrap().getControl();
                    sceneBounds.translate((int) panel.getLocationOnScreen().getX(), (int) panel.getLocationOnScreen().getY());
                } else {
                    Window window = scene.getWindow();
                    /*
                     * Field host_field =
                     * window.getClass().getDeclaredField("host");
                     * host_field.setAccessible(true); Object host =
                     * host_field.get(window); Field panel_field =
                     * host.getClass().getDeclaredField("this$0");
                     * panel_field.setAccessible(true); JFXPanel panel =
                     * (JFXPanel)panel_field.get(host);
                     * sceneBounds.translate((int)panel.getLocationOnScreen().getX(), (int)panel.getLocationOnScreen().getY());
                     */
                    // TODO: RT-12793
                    sceneBounds.translate((int) window.getX(), (int) window.getY());
                }
                setResult(sceneBounds);
            }
        };
        env.getExecutor().execute(env, true, bounds);
View Full Code Here

    static Boolean isInWindow(final NodeWrap<? extends Node> node, final Point p) {
        return new GetAction<Boolean>() {
            @Override
            public void run(Object... parameters) {
                Window window = node.getControl().getScene().getWindow();
                if (Double.isNaN(window.getX())) { // TODO: temporary stub for RT-12736
                    setResult(true);
                    return;
                }
                Bounds bounds = new BoundingBox(window.getX(), window.getY(), 0, window.getWidth(), window.getHeight(), 0);
                double x = node.getScreenBounds().getX();
                double y = node.getScreenBounds().getY();
                if (p == null) {
                    x+= node.getClickPoint().getX();
                    y+= node.getClickPoint().getY();
View Full Code Here

        }
    }
   
    private static void centerToOwner(DialogTemplate template) {
        FXDialog dialog = template.getDialog();
        Window window = dialog.getOwner();

        if(!centerToOwner(window, dialog)){
            template.getDialog().centerOnScreen();
        }
    }
View Full Code Here

TOP

Related Classes of javafx.stage.Window

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.