-
Bug
-
Resolution: Fixed
-
P1
-
fx2.1
-
2.1.0b16.
Run this code on linux and windows:
import javafx.application.Application;
import javafx.event.ActionEvent;
import javafx.event.EventHandler;
import javafx.scene.Scene;
import javafx.scene.control.Button;
import javafx.scene.layout.VBox;
import javafx.stage.Stage;
public class CoordinatesIssue extends Application {
public static void main(String[] args) {
launch(args);
}
@Override
public void start(final Stage stage) throws Exception {
final Button b = new Button("Press me");
VBox vb = new VBox();
vb.getChildren().addAll(b);
final Scene scene = new Scene(vb, 300, 300);
b.setOnAction(new EventHandler<ActionEvent>(){
@Override
public void handle(ActionEvent t) {
System.out.println("X:" + stage.getX() + " Y:" + stage.getY());
System.out.println("X:" + scene.getX() + " Y:" + scene.getY());
System.out.println("Button X:" + b.getBoundsInLocal().getMinX() + " Button Y:" + b.getBoundsInLocal().getMinY());
System.out.println("Button X:" + b.getBoundsInParent().getMinX() + " Button Y:" + b.getBoundsInParent().getMinY());
System.out.println("Button X:" + b.getLayoutBounds().getMinX() + " Button Y:" + b.getLayoutBounds().getMinY());
System.out.println("Button X:" + b.getLayoutY() + " Button Y:" + b.getLayoutY());
}
});
stage.setScene(scene);
stage.show();
}
}
If you press button:
Sample output for windows:
run:
X:802.0 Y:234.0
X:8.0 Y:30.0
Button X:-1.399999976158142 Button Y:-1.399999976158142
Button X:-1.399999976158142 Button Y:-1.399999976158142
Button X:0.0 Button Y:0.0
Button X:0.0 Button Y:0.0
Sample output for linux:
run:
X:802.0 Y:234.0
X:0.0 Y:0.0
Button X:-1.399999976158142 Button Y:-1.399999976158142
Button X:-1.399999976158142 Button Y:-1.399999976158142
Button X:0.0 Button Y:0.0
Button X:0.0 Button Y:0.0
Look on the second line of output: scene coordinates in linux don't take decoration into account.
That leads to situation when awt robot clicks in wrong place and that makes ALL tests which uses actions to fail on linux.
import javafx.application.Application;
import javafx.event.ActionEvent;
import javafx.event.EventHandler;
import javafx.scene.Scene;
import javafx.scene.control.Button;
import javafx.scene.layout.VBox;
import javafx.stage.Stage;
public class CoordinatesIssue extends Application {
public static void main(String[] args) {
launch(args);
}
@Override
public void start(final Stage stage) throws Exception {
final Button b = new Button("Press me");
VBox vb = new VBox();
vb.getChildren().addAll(b);
final Scene scene = new Scene(vb, 300, 300);
b.setOnAction(new EventHandler<ActionEvent>(){
@Override
public void handle(ActionEvent t) {
System.out.println("X:" + stage.getX() + " Y:" + stage.getY());
System.out.println("X:" + scene.getX() + " Y:" + scene.getY());
System.out.println("Button X:" + b.getBoundsInLocal().getMinX() + " Button Y:" + b.getBoundsInLocal().getMinY());
System.out.println("Button X:" + b.getBoundsInParent().getMinX() + " Button Y:" + b.getBoundsInParent().getMinY());
System.out.println("Button X:" + b.getLayoutBounds().getMinX() + " Button Y:" + b.getLayoutBounds().getMinY());
System.out.println("Button X:" + b.getLayoutY() + " Button Y:" + b.getLayoutY());
}
});
stage.setScene(scene);
stage.show();
}
}
If you press button:
Sample output for windows:
run:
X:802.0 Y:234.0
X:8.0 Y:30.0
Button X:-1.399999976158142 Button Y:-1.399999976158142
Button X:-1.399999976158142 Button Y:-1.399999976158142
Button X:0.0 Button Y:0.0
Button X:0.0 Button Y:0.0
Sample output for linux:
run:
X:802.0 Y:234.0
X:0.0 Y:0.0
Button X:-1.399999976158142 Button Y:-1.399999976158142
Button X:-1.399999976158142 Button Y:-1.399999976158142
Button X:0.0 Button Y:0.0
Button X:0.0 Button Y:0.0
Look on the second line of output: scene coordinates in linux don't take decoration into account.
That leads to situation when awt robot clicks in wrong place and that makes ALL tests which uses actions to fail on linux.
- relates to
-
JDK-8115761 Gtk: [Linux] scene coordinates are defined incorrectly.
-
- Closed
-