JavaFX 2 Automatic Column Width

前端 未结 8 834
盖世英雄少女心
盖世英雄少女心 2020-11-29 01:09

I have a JavaFX 2 table that is displaying contact details for people, lets imagine there are three columns: first name, last name and email address. When my application sta

8条回答
  •  遥遥无期
    2020-11-29 01:34

    This works for me in JavaFX 8

    table.setColumnResizePolicy( TableView.CONSTRAINED_RESIZE_POLICY );
    col1.setMaxWidth( 1f * Integer.MAX_VALUE * 50 ); // 50% width
    col2.setMaxWidth( 1f * Integer.MAX_VALUE * 30 ); // 30% width
    col3.setMaxWidth( 1f * Integer.MAX_VALUE * 20 ); // 20% width
    

    In the other examples you have the problem, the vertical scrollbar width is ignored.

提交回复
热议问题