Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8095332

[TabPane] TabPane's layout does not respond correctly when resized

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: P4
    • Resolution: Fixed
    • Affects Version/s: 7u45
    • Fix Version/s: emb-8u6, 8u20
    • Component/s: javafx
    • Labels:

      Description

      Include a TabPane in a Scene with a large number of tabs.
      Upon initial launch, the stage won't be wide enough to show all tabs and a dropdown arrow will appear
      Now use the dropdown to select the last tab.
      Maximize the window and notice how the tabs are not re-positioned correctly to take advantage of the additional space.
      Sometimes clicking on another tab will cause the layout to correct, other times it does not.

      The TabPane should recognize when it is resized and correctly layout its tabs.

      Code to produce this:
      {code:title=Misbehaving Tabs|borderStyle=solid}
      import javafx.application.Application;
      import javafx.scene.Parent;
      import javafx.scene.SceneBuilder;
      import javafx.scene.control.Tab;
      import javafx.scene.control.TabPane;
      import javafx.scene.control.TabPaneBuilder;
      import javafx.stage.Stage;

      public class SimpleSandboxApp extends Application
      {
        private TabPane _tabs;
        
        private Parent buildRoot()
        {
          int numTabs = 15;
          Tab[] tabs = new Tab[numTabs];
          for(int i = numTabs; i-->0; )
            tabs[i] = new Tab("Some Random Tab");
          
          _tabs = TabPaneBuilder.create()
              .tabs(tabs)
              .build();
          return _tabs;
        }
        
        @Override
        public void start(Stage stage) throws Exception
        {
          stage.setScene(SceneBuilder.create()
              .root(buildRoot())
              .build());
          stage.setTitle("Simple Sandbox");
          
          stage.show();
        }
        
        public static void main(String[] args)
        {
          Application.launch(args);
        }
      }
      {code}

        Attachments

          Activity

            People

            Assignee:
            jgiles Jonathan Giles
            Reporter:
            mmortonjfx Mat Morton (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved:
              Imported: