package mirror; import com.sun.javafx.scene.control.skin.ButtonSkin; import com.sun.javafx.scene.control.skin.LabeledText; import javafx.application.*; import javafx.geometry.NodeOrientation; import javafx.scene.*; import javafx.scene.paint.Color; import javafx.scene.shape.*; import javafx.scene.text.*; import javafx.scene.transform.Scale; import javafx.scene.transform.Translate; import javafx.scene.control.*; import javafx.stage.*; public class ScrollPaneUsingOrientation extends Application { static final boolean MIRROR_SCENE = true; public void start(Stage stage) { Group group = new Group(); Button button = new Button("Hello"); button.setLayoutX(5); button.setLayoutY(15); Line line = new Line(10, 8, 100, 150); Text text = new Text("Hello"); double x = 7, y = 100; text.setLayoutX(x); text.setLayoutY(y); double textWidth = text.getLayoutBounds().getWidth(); double textHeight = text.getLayoutBounds().getHeight(); Rectangle box = new Rectangle(textWidth, textHeight); box.setStroke(Color.BLACK); box.setStrokeWidth(1); box.setFill(Color.TRANSPARENT); box.setLayoutX(x); box.setLayoutY(y); group.getChildren().addAll(button, line, text, box); ScrollPane sView1 = new ScrollPane(); sView1.setContent(group); sView1.setPrefSize(75, 75); sView1.setLayoutX(20); sView1.setLayoutY(40); sView1.setPannable(true); sView1.setVisible(true); Group g2 = new Group(); g2.getChildren().addAll(sView1); Scene scene = new Scene(g2, 200, 200); stage.setScene(scene); if (MIRROR_SCENE) { scene.setNodeOrientation(NodeOrientation.RIGHT_TO_LEFT); } stage.show(); } public static void main(String[] args) { launch(args); } }