0 Replies Latest reply on Sep 3, 2013 1:07 PM by wzberger

    Right Aligned ToolBar Control - Spacer issue

    wzberger

      When adding a right aligned control to a toolbar I have to add a sping/spacer as described here - however, when an overflow button appears the spacer component is selectable in the overflow popup menu. Is there any way to avoid this behavior? The test below demonstrates the issue.

       

       

      //see: http://www.oracle.com/technetwork/articles/java/javafxbest2-1634274.html
      //section: Implementing Springs and Struts in the UI
      public class ToolBarOverflowTest extends Application
      {
        public static void main(String[] args)
        {
          Application.launch(ToolBarOverflowTest.class, args);
        }
        @Override
        public void start(Stage stage)
        {
          System.err.println(System.getProperty("javafx.runtime.version"));
          ToolBar toolBar = new ToolBar();
          for (int i = 1; i<6; i++)
            toolBar.getItems().add(new Button("ToolBarButton " + i));
          Region spring = new Region();
          HBox.setHgrow(spring, Priority.ALWAYS);       
          toolBar.getItems().add(spring);
          toolBar.getItems().add(new Button("Right ToolBarButton"));   
          BorderPane root = new BorderPane();
          root.setTop(toolBar);
          Scene scene = new Scene(root, 400, 300);
          stage.setScene(scene);
          stage.show();
        }
      }