JDK-8134278 : Move Stage/Window Outside Screen
  • Type: Bug
  • Component: javafx
  • Sub-Component: window-toolkit
  • Affected Version: 8u60
  • Priority: P5
  • Status: Open
  • Resolution: Unresolved
  • OS: linux_ubuntu
  • CPU: x86
  • Submitted: 2015-08-22
  • Updated: 2018-09-05
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
Other
tbdUnresolved
Related Reports
Relates :  
Description
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


Comments
To demonstrate the problem, use click and drag not the title bar, but the body itself. On Ubuntu 14.04 I do see a difference in behavior compared to mac - I cannot drag off the screen to the left or right, but can off the bottom. Dragging off the top appears to be a special case with the system bar (the title bar is likely going to be forced to be below.) There appears to be restrictions on the Mac - I cannot drag above the system bar, and cannot drag the title bar off the bottom of the screen. It would be interesting to try this with an undecorated stage.
15-10-2015

This seems to be a Linux-specific issue, probably in the window toolkit (glass).
24-08-2015