I have a laptop with a touchpad. The zoom functionality works on some programs and not others. For example, with the Chrome and Edge browsers, zoom resizes content on the screen but my Firefix browser zoom does nothing.
My question is if there is anything I can do to get the following simple JavaFX tutorial example to respond to the zoom gesture. I added the println() and can report that nothing is printed to the console when I do a zoom gesture.
public class ZoomAndRotate extends Application {
@Override
public void start(Stage primaryStage) throws Exception {
HBox hBox = new HBox();
hBox.setAlignment(Pos.CENTER);
hBox.getChildren().add(new Button("Button 1"));
hBox.getChildren().add(new Button("Button 2"));
hBox.setOnZoom(e -> {
System.out.println("zoom code engaged");
hBox.setScaleX(hBox.getScaleX() * e.getZoomFactor());
hBox.setScaleY(hBox.getScaleY() * e.getZoomFactor());
});
Scene mySceneGraph = new Scene(hBox, 800, 600);
primaryStage.setScene(mySceneGraph);
primaryStage.show();
}
public static void main(String[] args) {
launch(args);
}
}
I'm using JavaFX 15, Java 11, on Windows 10, with a Dell touchpad. Can provide more specifics if needed. I don't see anything in the windows control panel for the touchpad that helps. The Dell Touchpad configuration panel has gestures enabled and zoom selected. As I said at the top, zoom does work for some programs.