title: javafx HBox move elements around
body: <p>got this </p>
  
  <pre><code>  package net.makerimages.starling.src.window;
  
  import javafx.application.Platform;
  import javafx.event.ActionEvent;
  import javafx.event.EventHandler;
  import javafx.geometry.Insets;
  import javafx.geometry.Pos;
  import javafx.scene.control.Button;
  import javafx.scene.control.Label;
  import javafx.scene.layout.HBox;
  import javafx.scene.layout.Priority;
  import net.makerimages.starling.src.Main;
  
   /**
   * Created with IntelliJ IDEA.
   * User: Kodukas
   * Date: 29.11.13
   * Time: 23:53
   * To change this template use File | Settings | File Templates.
   */
  public class TopBar extends HBox
  {
  public Button closeButton;
  public Button minMaxButton;
  public Label titleLabel;
  
  public TopBar()
  {
      titleLabel=new Label("Starling browser");
      closeButton=new Button("X");
  
      closeButton.setOnAction(new EventHandler&lt;ActionEvent&gt;() {
  
          @Override
          public void handle(ActionEvent actionEvent) {
              Platform.exit();
          }
      });
      closeButton.setStyle("-fx-opacity: 0.9;");
  
      minMaxButton=new Button("|  |");
      minMaxButton.setOnAction(new EventHandler&lt;ActionEvent&gt;() {
  
          @Override
          public void handle(ActionEvent actionEvent) {
  
              if(Main.stg.isFullScreen()==false)
              {
                   Main.stg.setFullScreen(true);
                  minMaxButton.setText("||");
              }
              else if(Main.stg.isFullScreen()==true)
              {
                  Main.stg.setFullScreen(false);
                  minMaxButton.setText("|  |");
                  Main.browser.setMaxHeight(Main.browser.getHeight()-20);
              }
          }
      });
  
  
  
      this.getChildren().addAll(closeButton,minMaxButton);
      this.getChildren().add(titleLabel);
      setMargin(titleLabel,new Insets(0,10,0,0));
  
  
  }
  }
  </code></pre>
  
  <p>What I would like to have is the buttons on the right and the label in the centre, however anything I`ve tried for that has not worked.(this is used as a toolbar in a borderPane)
   Ive tried literally everything I know of</p>