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.