Package javafx.geometry

Examples of javafx.geometry.Rectangle2D


    maxBtn.setOnMouseClicked(new EventHandler<MouseEvent>() {
      @Override
      public void handle(MouseEvent event) {
                final double stageY = Utils.isMac() ? stage.getY() - 22 : stage.getY(); // TODO Workaround for RT-13980
                final Screen screen = Screen.getScreensForRectangle(stage.getX(), stageY, 1, 1).get(0);
                Rectangle2D bounds = screen.getVisualBounds();
                if (bounds.getMinX() == stage.getX() && bounds.getMinY() == stageY &&
                        bounds.getWidth() == stage.getWidth() && bounds.getHeight() == stage.getHeight()) {
                    if (backupWindowBounds != null) {
                        stage.setX(backupWindowBounds.getMinX());
                        stage.setY(backupWindowBounds.getMinY());
                        stage.setWidth(backupWindowBounds.getWidth());
                        stage.setHeight(backupWindowBounds.getHeight());
                        maxBtn.setImage(maxImage);
                    }
                } else {
                    backupWindowBounds = new Rectangle2D(stage.getX(), stage.getY(), stage.getWidth(), stage.getHeight());
                    final double newStageY = Utils.isMac() ? screen.getVisualBounds().getMinY() + 22 : screen.getVisualBounds().getMinY(); // TODO Workaround for RT-13980
                    stage.setX(screen.getVisualBounds().getMinX());
                    stage.setY(newStageY);
                    stage.setWidth(screen.getVisualBounds().getWidth());
                    stage.setHeight(screen.getVisualBounds().getHeight());
View Full Code Here


          });
          setOnMouseDragged(new EventHandler<MouseEvent>() {
              @Override public void handle(MouseEvent e) {
                  final double stageY = Utils.isMac() ? stage.getY() + 22 : stage.getY(); // TODO Workaround for RT-13980
                  final Screen screen = Screen.getScreensForRectangle(stage.getX(), stageY, 1, 1).get(0);
                  Rectangle2D visualBounds = screen.getVisualBounds();
                  if (Utils.isMac()) visualBounds = new Rectangle2D(visualBounds.getMinX(), visualBounds.getMinY() + 22,
                          visualBounds.getWidth(), visualBounds.getHeight()); // TODO Workaround for RT-13980
                  double maxX = Math.min(visualBounds.getMaxX(), e.getScreenX() + dragOffsetX);
                  double maxY = Math.min(visualBounds.getMaxY(), e.getScreenY() - dragOffsetY);
                  stage.setWidth(Math.max(stageMinimumWidth, maxX - stage.getX()));
                  stage.setHeight(Math.max(stageMinimumHeight, maxY - stageY));
                  e.consume();
              }
          });
View Full Code Here

  /**
   * Positions the notification window
   */
  private void positionNotification() {
    final Screen screen = Screen.getPrimary();
    final Rectangle2D bounds = screen.getVisualBounds();
    notifyPopup.setX(bounds.getMaxX() - NOTIFY_WINDOW_WIDTH - 10d);
    notifyPopup.setY(bounds.getMaxY() - NOTIFY_WINDOW_HEIGHT - 10d);
  }
View Full Code Here

    log.debug("Minimizing application to system tray");
    if (dummyPopup == null) {
      // javafx.stage.Popup does not work
      dummyPopup = new Stage();
      final Screen screen = Screen.getPrimary();
      final Rectangle2D bounds = screen.getVisualBounds();
      dummyPopup.initModality(Modality.NONE);
      dummyPopup.initStyle(StageStyle.UTILITY);
      dummyPopup.setOpacity(0d);
      final Group root = new Group();
      root.getChildren().add(new Text("Close"));
      dummyPopup.setScene(new Scene(root, NOTIFY_WINDOW_WIDTH,
          NOTIFY_WINDOW_HEIGHT, Color.TRANSPARENT));
      dummyPopup.setX(bounds.getMaxX());
      dummyPopup.setY(bounds.getMaxY());
      dummyPopup.show();

      if (isSystemTraySupported()) {
        showNotification(RS.rbLabel(KEY.APP_WIN_SYSTRAY_MIN_INFO));
      }
View Full Code Here

      public void run() {
        webSetupView.load();
        changeCenterView(webSetupView, 4);
      }
    }));
    final Rectangle2D bounds = Screen.getPrimary().getVisualBounds();
    final double appWidth = Math.min(bounds.getWidth(), APPLICATION_WIDTH);
    final double appHeight = Math.min(bounds.getHeight(), APPLICATION_HEIGHT);
    applicationFrame = new AppFrame(stage, content, appWidth, appHeight, appWidth + 10d,
        appHeight + 10d, false, new String[] { RS.path(RS.CSS_MAIN), RS.path(RS.CSS_DISPLAY_SHELF) },
        controlBar.createTitleBarItems());
    changeCenterView(connectionView, 0);
  }
View Full Code Here

  public void start(Stage stage) {

    FlowPane lFlowPane = new FlowPane();
      lFlowPane.setVgap(20);
      lFlowPane.setHgap(20);
      Rectangle2D primaryScreenBounds = Screen.getPrimary().getVisualBounds();
      lFlowPane.setPrefWrapLength(primaryScreenBounds.getWidth());
      
    for (int j = 0; j < 10; j++)
//int j = 2;
    {
      CircularPane lCircularPane = new CircularPane();
View Full Code Here

  public void start(Stage stage) {

    FlowPane lFlowPane = new FlowPane();
      lFlowPane.setVgap(20);
      lFlowPane.setHgap(20);
      Rectangle2D primaryScreenBounds = Screen.getPrimary().getVisualBounds();
      lFlowPane.setPrefWrapLength(primaryScreenBounds.getWidth());
      
    for (int j = 0; j < 360; j += 10)
    {
      CircularPane lCircularPane = new CircularPane();
      lCircularPane.setStyle("-fx-border-color:black;");
View Full Code Here

  public void start(Stage stage) {

    FlowPane lFlowPane = new FlowPane();
      lFlowPane.setVgap(20);
      lFlowPane.setHgap(20);
      Rectangle2D primaryScreenBounds = Screen.getPrimary().getVisualBounds();
      lFlowPane.setPrefWrapLength(primaryScreenBounds.getWidth());
      
    for (int j = 0; j < 360; j += 10)
    {
      CircularPane lCircularPane = new CircularPane();
      lCircularPane.setStyle("-fx-border-color:black;");
View Full Code Here

        @Override
        public void windowOpened(java.awt.event.WindowEvent e) {
          java.awt.Window w = e.getWindow();
          e.getWindow().getPreferredSize();
         
          Rectangle2D preferredBounds = new Rectangle2D(w.getX(), w.getY(), w.getPreferredSize().getWidth(), w.getPreferredSize().getHeight());
          Rectangle2D parentBounds = new Rectangle2D(parentFrame.getX(), parentFrame.getY(), parentFrame.getWidth(), parentFrame.getHeight());
         
          Rectangle2D s = getReasonableSize(preferredBounds, parentBounds);
         
          dialog.setBounds((int)s.getMinX(), (int)s.getMinY(), (int)s.getWidth(), (int)s.getHeight());
        }
      });
     
      dialog.getContentPane().add(fxPanel);
      dialog.setVisible(true); // We'll compute the bounds in the windowOpened event...
View Full Code Here

      // Use a min size to avoid that sometimes the preferred size of the FX pane seems to be
      // 0. Might be a timing problem... :-(
      final double minWidth = 400.0;
      final double minHeight = 200.0;
     
      preferredBounds = new Rectangle2D(
          preferredBounds.getMinX(),
          preferredBounds.getMinY(),
          Math.max(minWidth, preferredBounds.getWidth()),
          Math.max(minHeight, preferredBounds.getHeight()));
     
      // Get the Screen to display the dialog
      Screen screen = parentBounds != null
          ? Screen.getScreenForLocation(
              (int) (parentBounds.getMinX() + parentBounds.getWidth() / 2),
              (int) (parentBounds.getMinY() + parentBounds.getHeight() / 2))
          : null;
      if (screen == null) {
        screen = Screen.getMainScreen();
      }
     
      // Make sure the dialog doesn't exceed 70% of the screen size
     
      // Create the unpositioned rectangle for the dialog
      Rectangle2D rect = new Rectangle2D(
          screen.getX(),
          screen.getY(),
          Math.min(preferredBounds.getWidth(), screen.getWidth() * 0.7),
          Math.min(preferredBounds.getHeight(), screen.getHeight() * 0.7));
     
      // Position the rectangle (center over parent, then make sure it's contained in the screen)
     
      Rectangle2D screenBounds = new Rectangle2D(screen.getX(), screen.getY(), screen.getWidth(), screen.getHeight());
      if (parentBounds == null) {
        parentBounds = screenBounds;
      }
     
      rect = GeoFx.center(rect, parentBounds);
View Full Code Here

TOP

Related Classes of javafx.geometry.Rectangle2D

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.