I remember trying to βdeleteβ empty columns while playing with css properties in the past with no luck. The workaround was either
- set the width of the cityColumn prefix to cover the entire space manually:
TableColumn<String, String> cityColumn = new TableColumn<String, String>("City Name"); cityColumn.setPrefWidth(table.getPrefWidth() - 2);
-2 for the width of the borders. You can also directly associate the column width property with the table width attribute, as a result, the column width is automatically updated when the table is resized. See this answer at https://stackoverflow.com/a/464628/
Or
- Set the column resizing policy to CONSTRAINED_RESIZE_POLICY :
table.setColumnResizePolicy(TableView.CONSTRAINED_RESIZE_POLICY);
Uluk Biy
source share