你好,你能帮我画出 table 的轮廓吗?我希望表格中的所有行都有轮廓。感谢您的帮助。我的 table 看起来像这样:
TableColumn busNumberCol = new TableColumn("Linia");
busNumberCol.setCellValueFactory(
new PropertyValueFactory<>("busNumber"));
busNumberCol.setPrefWidth(tb.getPrefWidth()/5);
TableColumn courseCol = new TableColumn("Kierunek");
courseCol.setCellValueFactory(
new PropertyValueFactory<>("nameBusStpo"));
courseCol.setPrefWidth((tb.getPrefWidth()-tb.getPrefWidth()/5)/2-1);
TableColumn departureCol = new TableColumn("Odjazd");
departureCol.setPrefWidth((tb.getPrefWidth()-tb.getPrefWidth()/5)/2-1);
departureCol.setCellValueFactory(
new PropertyValueFactory<>("busTimetable"));
table.setPrefHeight(tb.getPrefHeight());
table.setStyle("-fx-background-color: orange");
table.setPrefWidth(tb.getPrefWidth());
table.setItems(list);
table.getColumns().addAll(busNumberCol, courseCol, departureCol);
table.setPlaceholder(new Label(""));
最佳答案
You can use:
.table-row-cell{
-fx-border-color:red;
-fx-border-width:1.0;
/* -fx-background-color */
}
请注意,这会在每一行周围添加一个边框。对于背景颜色,您可以使用 /* -fx-background-color*/
Also
有关 TableView 的更多样式,请查看 Change JavaFX TableView font size
关于表的 JavaFX 表轮廓,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39532009/