Skip to Main Content

Java SE (Java Platform, Standard Edition)

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Passing negative value to setX() does not work under Linux

DaytonaJohnSep 29 2013

     I am working on an application that remembers the users window layout between executions. I am simply saving the window locations and sizes in a configuration file. If I save a window position where the left edge of the window is off screen, the restore works fine under Windows, but Linux always clips the x value to 0, so the left edge of the window is always at the left edge of the screen.  Here is a simple example to demonstrate:

public class BugTest extends Application {
   
    @Override
    public void start(Stage primaryStage) {
       
        StackPane root = new StackPane();
       
        Label label = new Label("This window should be partly off screen");
        root.getChildren().add(label);
       
        Scene scene = new Scene(root, 300, 250);
       
        primaryStage.setTitle("Hello World!");
        primaryStage.setScene(scene);
        primaryStage.setX(-100.0);
        primaryStage.show();
    }

    /**
     * The main() method is ignored in correctly deployed JavaFX application.
     * main() serves only as fallback in case the application can not be
     * launched through deployment artifacts, e.g., in IDEs with limited FX
     * support. NetBeans ignores main().
     *
     * @param args the command line arguments
     */
    public static void main(String[] args) {
        launch(args);
    }
}

This works as expected under Windows, but incorrectly positions primaryStage at x=0 under Linux. Am I doing something wrong? Any ideas on how to get this working correctly? Or should I file a bug report?

I am using JDK 1.7.0_25 on Ubuntu 12.04.

Thanks for any ideas.

Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Oct 27 2013
Added on Sep 29 2013
0 comments
327 views