title: How can I mirror the tab in the given code?
body: <p>I received this code from a kind stranger some time ago, a while from then, I've been trying to mirror the effects of this code to no avail.</p>
  
  <p>I want the tab to slide in from the left, as opposed to the right, which is what the code currently does.</p>
  
  <pre><code>import javafx.application.Application;
  import javafx.animation.TranslateTransition;    
  import javafx.geometry.Insets;
  import javafx.geometry.Side;    
  import javafx.util.Duration;    
  import javafx.stage.Stage;
  import javafx.scene.Scene;  
  import javafx.scene.control.Label;
  import javafx.scene.control.Tab;
  import javafx.scene.control.TabPane;
  import javafx.scene.control.TableColumn;
  import javafx.scene.control.TableView;  
  import javafx.scene.layout.Region;
  import javafx.scene.layout.BorderPane;
  import javafx.scene.layout.StackPane;
  
  public class PlaylistDemo
  extends Application {
      private static final Duration ANIMATION_SPEED = Duration.seconds(0.5);
  
      private enum ExpandState { EXPANDED, HIDDEN, CHANGING }
  
      private ExpandState expandState = ExpandState.HIDDEN;
  
      @Override
      public void start(Stage stage) {
          TableView&lt;Object&gt; musicList = new TableView&lt;&gt;();
          musicList.getColumns().add(new TableColumn&lt;Object, Object&gt;("Name"));
          musicList.getColumns().add(new TableColumn&lt;Object, Object&gt;("Artist"));
          musicList.getColumns().add(new TableColumn&lt;Object, Object&gt;("Album"));
  
          Region playlist = new BorderPane(musicList);
          playlist.setMaxWidth(Region.USE_PREF_SIZE);
          playlist.setStyle("-fx-background-color: white;");
  
          Label tabLabel = new Label("PlayList");
          Tab playlistTab = new Tab(null, playlist);
          playlistTab.setGraphic(tabLabel);
          playlistTab.setClosable(false);
  
          TabPane tabPane = new TabPane(playlistTab);
          tabPane.setSide(Side.LEFT);
          tabPane.setRotateGraphic(true);
  
          // Placeholder, to reserve space for playlist tab.
          TabPane dummyTabPane = new TabPane(new Tab("Dummy", new Label()));
          dummyTabPane.setSide(Side.LEFT);
          dummyTabPane.setVisible(false);
  
          Label player = new Label("Music player goes here");
          player.setPadding(new Insets(200));
  
          BorderPane musicPane =
              new BorderPane(player, null, dummyTabPane, null, null);
          BorderPane.setMargin(player, new Insets(0, 24, 0, 0));
  
          StackPane applicationPane = new StackPane(musicPane, tabPane);
  
          playlist.layoutBoundsProperty().addListener((o, old, b) -&gt; {
              double tabWidth = playlist.localToScene(b).getMinX() -
                  tabPane.localToScene(0, 0).getX();
              tabPane.setTranslateX(applicationPane.getWidth() - tabWidth);
          });
          applicationPane.widthProperty().addListener((o, old, width) -&gt; {
              double tabWidth =
                  playlist.localToScene(playlist.getLayoutBounds()).getMinX() -
                  tabPane.localToScene(0, 0).getX();
              tabPane.setTranslateX(applicationPane.getWidth() - tabWidth);
          });
  
          tabLabel.setOnMouseEntered(e -&gt; {
              if (expandState == ExpandState.HIDDEN) {
                  TranslateTransition transition =
                      new TranslateTransition(ANIMATION_SPEED, tabPane);
                  transition.setByX(-playlist.getWidth());
  
                  expandState = ExpandState.CHANGING;
                  transition.setOnFinished(ae -&gt; {
                      expandState = ExpandState.EXPANDED;
                  });
  
                  transition.play();
              }
          });
  
          playlist.setOnMouseExited(e -&gt; {
              if (expandState == ExpandState.EXPANDED) {
                  TranslateTransition transition =
                      new TranslateTransition(ANIMATION_SPEED, tabPane);
                  transition.setByX(playlist.getWidth());
  
                  expandState = ExpandState.CHANGING;
                  transition.setOnFinished(ae -&gt; {
                      expandState = ExpandState.HIDDEN;
                  });
  
                  transition.play();
              }
          });
  
          stage.setScene(new Scene(applicationPane));
          stage.setTitle("Player");
          stage.show();
      }
  
      public static class Main {
          public static void main(String[] args) {
              Application.launch(PlaylistDemo.class, args);
          }
      }
  }
  </code></pre>
  
  <p>If you could explain why the tab gets disjointed when the following changes are made to the code</p>
  
  <pre><code>        tabPane.setSide(Side.RIGHT);
  
          dummyTabPane.setSide(Side.RIGHT);
  </code></pre>
  
  <p>That'd be great too!</p>