title: Set ToolBar Buttons square and all the same size in JavaFX 2
body: <p>In the code below I have a ToolBar and I add buttons of various sizes to it. I would like the buttons to be square and all the same size. So basically find the longest width or height from all the buttons, and set all other button widths and height to this size. However, the buttons can change size so I require a binding I think. I can't quite figure it out - anyone know how to do it?</p>
  
  <pre><code>import javafx.application.Application;
  import javafx.scene.Scene;
  import javafx.scene.control.Button;
  import javafx.scene.control.ToolBar;
  import javafx.scene.layout.BorderPane;
  import javafx.stage.Stage;
  
  public class ToolBarButtonTest extends Application {
      @Override
      public void start(Stage stage) throws Exception {
          BorderPane borderPane = new BorderPane();
          Scene scene = new Scene(borderPane, 500, 500);
  
          ToolBar toolBar = new ToolBar();
  
          Button button1 = new Button("s");
          Button button2 = new Button("ss");
          Button button3 = new Button("sss");
  
          toolBar.getItems().addAll(button1, button2, button3);
  
          borderPane.setTop(toolBar);
  
          stage.setScene(scene);
          stage.show();
      }
  
      public static void main(String[] args) {
          launch(args);
      }
  }
  </code></pre>
  
  <p>Thanks, Nick.</p>