TableView FXML problems
Daniel Opitz
daniel at lotsovcookiez.com
Sun Dec 2 07:11:59 PST 2012
Hello,
I'm currently trying to learn some FXML and have at least 4 problems
with the TableView component:
1) TableView shows some strange behavior after maximizing the window:
https://dl.dropbox.com/u/1030857/maximized.PNG
and minimizing it afterwards:
https://dl.dropbox.com/u/1030857/normalaftermax.PNG
When resizing (particularily making the window bigger) the unstyled
table is visible too:
https://dl.dropbox.com/u/1030857/resizing.PNG
I set some some constraints on the columns and I am using the
CONSTRAINED_RESIZE_POLICY and here is the FXML:
<TableView fx:id="taskTable" prefHeight="-1.0"
prefWidth="-1.0" VBox.vgrow="ALWAYS">
<placeholder><Label text="" /></placeholder>
<columnResizePolicy><TableView
fx:constant="CONSTRAINED_RESIZE_POLICY" /></columnResizePolicy>
<columns>
<TableColumn text="Completed" minWidth="75"
prefWidth="75" maxWidth="75" >
<cellValueFactory><PropertyValueFactory property="completed"
/></cellValueFactory>
</TableColumn>
<TableColumn text="Task">
<cellValueFactory><PropertyValueFactory property="name"
/></cellValueFactory>
</TableColumn>
<TableColumn text="Progress" minWidth="100"
prefWidth="100" maxWidth="100">
<cellValueFactory><PropertyValueFactory property="progress"
/></cellValueFactory>
</TableColumn>
</columns>
<items>
<FXCollections fx:factory="observableArrayList">
<Task completed="false" name="Random"
progress="0" />
</FXCollections>
</items>
</TableView>
The TableView Control sits in a VBox which sits in the center of a
BorderPane.
2) I have found some code to hide the table header:
|Pane header = (Pane) table.lookup("TableHeaderRow");
header.setVisible(*false*);
table.setLayoutY(-header.getHeight());
table.autosize();|
but I don't know where I can call it. I have a controller for the Main
Window and if I use the Initializable interface I obviously get
NullPointerException, because the TableView isn't created yet.
3) Is it possible to remove the resize lines / column borders? I tried
changing CSS of the column-resize-line substructure of the TableView,
but with no success...
4) I haven't found anything reliable on the net: How can I set a
Checkbox Cell Factory in the table using FXML? I did it earlier using
DataFX cell factories, but only in pure Java.
Kind regards,
Daniel Opitz
More information about the openjfx-dev
mailing list