gpt4 book ai didi

表的 JavaFX 表轮廓

转载 作者:塔克拉玛干 更新时间:2023-11-02 19:13:52 24 4
gpt4 key购买 nike

你好,你能帮我画出 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/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com