JFX25: TableView + col.setMaxWidth() now clipping column headers

John Hendrikx john.hendrikx at gmail.com
Tue Jul 1 02:00:18 UTC 2025


Hi Cormac,

That definitely looks like a bug.  Setting the maximum constraint should
not have that effect.  The documentation describes what you'd expect and
does not allude to the odd side effects you are seeing.

Some work was done recently on the resizing of table columns, perhaps a
regression was introduced there.

--John

On 29/06/2025 01:41, Cormac Redmond wrote:
> Hi,
>
> While testing JFX25 (on Windows), previously perfectly-sized column
> sizes are now "too small", hiding parts of the column header.
>
> Code to reproduce:
>
> public class TableViewColSizeBug extends Application {
>
>     @Override
>     public void start(Stage stage) {
>         TableView<String> table = new TableView<>();
>         TableColumn<String, String> col1 = new TableColumn<>();
>         col1.setGraphic(new Text("Column One (... ...)"));
>
>        
> table.setColumnResizePolicy(TableView.CONSTRAINED_RESIZE_POLICY_FLEX_LAST_COLUMN);
>
>         // Setting a max width causes a "too small" column size
>         col1.setMaxWidth(500); // Note large param
>
>         table.getColumns().addAll(col1, new TableColumn<>("Col 2"),
> new TableColumn<>("Col 3"), new TableColumn<>("Col 4"), new
> TableColumn<>("Col 5"));
>         stage.setScene(new Scene(new VBox(table), 600, 200));
>         stage.show();
>     }
>
>     public static void main(String[] args) {
>         launch();
>     }
> }
>
>  
> Notice the clear difference between JFX24 and JFX25 behaviour. If you
> do NOT setMaxWidth, there is no issue. For some reason, calling
> setMaxWidth, no matter how large the param, triggers this.
>
> JFX25 (as per code above, setting a column Text graphic), col width
> too small:
> image.png
>
> JFX25 using "new TableColumn<>("Column One (... ...)")", instead of
> setting a Text graphic; col width also too small:
> image.png
>
> JFX25 when you do NOT do setMaxWidth(...), looks fine:
>
> image.png
> JFX24 (in all instances, looks fine):
> image.png
>
> Is this a bug?
>
>
> Kind Regards,
> Cormac
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mail.openjdk.org/pipermail/openjfx-dev/attachments/20250701/657760bb/attachment-0001.htm>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: image.png
Type: image/png
Size: 11186 bytes
Desc: not available
URL: <https://mail.openjdk.org/pipermail/openjfx-dev/attachments/20250701/657760bb/image-0004.png>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: image.png
Type: image/png
Size: 9817 bytes
Desc: not available
URL: <https://mail.openjdk.org/pipermail/openjfx-dev/attachments/20250701/657760bb/image-0005.png>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: image.png
Type: image/png
Size: 10133 bytes
Desc: not available
URL: <https://mail.openjdk.org/pipermail/openjfx-dev/attachments/20250701/657760bb/image-0006.png>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: image.png
Type: image/png
Size: 13967 bytes
Desc: not available
URL: <https://mail.openjdk.org/pipermail/openjfx-dev/attachments/20250701/657760bb/image-0007.png>


More information about the openjfx-dev mailing list