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

[TableColumn] Inconsistent behaviour when resizing the last nested column on the right

    XMLWordPrintable

Details

    • Bug
    • Resolution: Fixed
    • P4
    • 8u20
    • 7u45, 8
    • javafx
    • All

    Description

      If you run the code below, it shows a column with 3 nested columns under it.

      If you move the mouse to the right of the 1st or 2nd nested column and resize, then just that column's width is changed (as well as the parent column).

      However, if you do the same to the 3rd nested column, all 3 columns are given extra width. It is as if you are resizing the parent column.

      I think that if you start the resize inside the nested columns height, then it should just resize the nested column (and the parent obviously). If you move the mouse up so it is now level with the top column and start the resize from there, then it should resize the top column and distribute the width to the nested columns appropriately.

      ----------------------------
      |Top Column Name|<- Drag here resizes "Top Column Name" column and distributes width appropriately
      |---------------------------|
      |Sub 1|Sub 2|Sub 3|<- Drag here resizes "Sub 3" column (and the top one)
      ----------------------------


      import javafx.application.Application;
      import javafx.scene.Scene;
      import javafx.scene.control.TableColumn;
      import javafx.scene.control.TableView;
      import javafx.scene.layout.BorderPane;
      import javafx.stage.Stage;

      public class NestedColumnTest extends Application {
          @Override
          public void start(Stage stage) throws Exception {
              BorderPane pane = new BorderPane();
              Scene scene = new Scene(pane, 500, 500);
              stage.setScene(scene);

              TableView<String[]> table = new TableView<>();
              TableColumn<String[],String> topColumn = new TableColumn<>("Top Column Name");

              topColumn.getColumns().add(new TableColumn<String[], Object>("Sub Col 1"));
              topColumn.getColumns().add(new TableColumn<String[], Object>("Sub Column 2"));
              topColumn.getColumns().add(new TableColumn<String[], Object>("Sub Column 3 with extra text"));

              table.getColumns().add(topColumn);

              pane.setCenter(table);
              stage.show();
          }

          public static void main(String[] args) {
              Application.launch(args);
          }
      }

      Attachments

        Activity

          People

            msladecek Martin Sládeček
            ndarcy Nick D'Arcy
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:
              Imported: