Skip to Main Content

Java SE (Java Platform, Standard Edition)

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Set min-width for TableView column headers

jpgamaralAug 2 2013 — edited Aug 2 2013

Hello.

I'm trying to set a min-width for all my column headers, but I'm not being successful. I can set it for a single column in code using

shortAddress.setMinWidth(80);

But the following CSS code doesn't work.


.table-view .column-header {

    -fx-font: bold 1em Ubuntu;

    -fx-min-width: 80px;

}

.table-view .column-header .label {

    -fx-min-width: 80px;

}

I know I could iterate over all the column headers and set the min-width for each, but I'd rather use CSS because it's more maintainable.


The following images show the header with and without min-width


http://i43.tinypic.com/xdcoci.png


http://i39.tinypic.com/2guw3ug.png

Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Aug 30 2013
Added on Aug 2 2013
2 comments
465 views