JDK-8113886 : TableView Columns growing behaviour
  • Type: Bug
  • Component: javafx
  • Sub-Component: controls
  • Affected Version: fx2.0
  • Priority: P3
  • Status: Closed
  • Resolution: Fixed
  • Submitted: 2011-07-07
  • Updated: 2023-01-10
  • Resolved: 2011-07-08
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
Other
fx2.0Fixed
Related Reports
Relates :  
Description
With this sample code based on empty ObservableList, the columns not growing. With two row-items, the columns are growing but threre is a third empty, useless "column" in the table visible.

public void start(Stage primaryStage) throws Exception {
        Group rootGroup = new Group();
        Scene scene = new Scene(rootGroup, 800, 600);
 
        primaryStage.setScene(scene);
 
        ObservableList<Dimension> testItems = FXCollections.observableArrayList();
        //testItems.add(new Dimension(100, 200));
        //testItems.add(new Dimension(300, 400));
 
        TableView<Dimension> table = new TableView<Dimension>();
        table.setItems(testItems);
 
        TableColumn<String> testColumn = new TableColumn<String>("Width");
        testColumn.setResizable(true);
        testColumn.setProperty("width");
        testColumn.setMinWidth(100);
 
        TableColumn<String> testColumn2 = new TableColumn<String>("Height");
        testColumn2.setResizable(true);
        testColumn2.setProperty("height");
        testColumn2.setMinWidth(100);
 
        table.getColumns().addAll(testColumn, testColumn2);
        table.setColumnResizePolicy(TableView.CONSTRAINED_RESIZE_POLICY);
 
        BorderPane mainPane = new BorderPane();
        mainPane.setCenter(table);
 
        scene.setRoot(mainPane);
 
        primaryStage.centerOnScreen();
        primaryStage.setVisible(true);
    }

Comments
Verified for graphics-scrum-2413/2011-07-14_03-22-53
15-07-2011

Resolved, but I added some additional Jira issues for related issues that were identified: RT-14886 and RT-14887
08-07-2011

I can recreate here - although your application was not a fully-executable sample app. I have attached the test app I had to write to recreate the issue. There are two separate issues: 1) Columns are not resized at all if there is no data. They just take their default width - the constrained resize policy is not operating. 2) The TableView has a little bit of space on the right-hand side that shouldn't be visible. This is not visible when a vertical scrollbar is visible, so it's likely related to that. See attached screenshots for more detail.
08-07-2011