Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8134278

Move Stage/Window Outside Screen

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: P5 P5
    • tbd
    • 8u60
    • javafx

      FULL PRODUCT VERSION :
      owner@owner-VirtualBox:~$ java -version
      java version "1.8.0_60"
      Java(TM) SE Runtime Environment (build 1.8.0_60-b27)
      Java HotSpot(TM) 64-Bit Server VM (build 25.60-b23, mixed mode)
      owner@owner-VirtualBox:~$


      ADDITIONAL OS VERSION INFORMATION :
      owner@owner-VirtualBox:~$ lsb_release -a
      No LSB modules are available.
      Distributor ID: Ubuntu
      Description: Ubuntu 14.04 LTS
      Release: 14.04
      Codename: trusty
      owner@owner-VirtualBox:~$


      A DESCRIPTION OF THE PROBLEM :
      Set x and y for a stage or window does not allow the stage or window to leave the screen area. This makes it impossible to make custom dragging behavior or borders for undecorated windows though the issue also occurs with decorated windows.

      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      Create a new stage or window and try to move it half way out of the screen area or over the task bar using set X or Y. This is impossible dragging it by the native title bar but is not possible to do so programmatically from JavaFX.

      EXPECTED VERSUS ACTUAL BEHAVIOR :
      EXPECTED -
      I would expect the stage and or window to move exactly to the screen coordinates I tell it to.
      ACTUAL -
      The stage or window moves to the edge of the launcher/taskbar and is stopped from leaving the screen.

      REPRODUCIBILITY :
      This bug can be reproduced always.

      ---------- BEGIN SOURCE ----------
      package org.dockfx.demo;

      import javafx.application.Application;
      import javafx.event.ActionEvent;
      import javafx.event.EventHandler;
      import javafx.scene.Scene;
      import javafx.scene.control.Button;
      import javafx.scene.input.MouseEvent;
      import javafx.scene.layout.StackPane;
      import javafx.stage.Stage;
       
      public class UndecoratedDrag extends Application {
          public static void main(String[] args) {
              launch(args);
          }
          
          @Override
          public void start(Stage primaryStage) {
              primaryStage.setTitle("Hello World!");
              Button btn = new Button();
              btn.setText("Say 'Hello World'");
              btn.setOnAction(new EventHandler<ActionEvent>() {
       
                  @Override
                  public void handle(ActionEvent event) {
                      System.out.println("Hello World!");
                  }
              });
              
              StackPane root = new StackPane();
              root.getChildren().add(btn);
              primaryStage.setScene(new Scene(root, 300, 250));
              primaryStage.show();
              
              // dragging on the scene will allow us to move the window
              // but not outside the screen or over the taskbar like we can with
              // the native title bar
              primaryStage.getScene().setOnMouseDragged(new EventHandler<MouseEvent>() {

                @Override
                public void handle(MouseEvent event) {
                  primaryStage.setX(event.getScreenX());
                  primaryStage.setY(event.getScreenY());
                }
                
              });
          }
      }
      ---------- END SOURCE ----------

      CUSTOMER SUBMITTED WORKAROUND :
      There is currently no work around that I have discovered.

      SUPPORT :
      YES

            tsayao Thiago Sayao
            webbuggrp Webbug Group
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated: