[Enhancement] 给 TableView 添加样式 (#4854)

This commit is contained in:
Calboot
2025-12-12 22:00:55 +08:00
committed by GitHub
parent 29e40ec1a5
commit b6d95c3ebb
2 changed files with 58 additions and 0 deletions

View File

@@ -102,6 +102,7 @@ public class ModUpdatesPage extends BorderPane implements DecoratorPage {
TableView<ModUpdateObject> table = new TableView<>(objects); TableView<ModUpdateObject> table = new TableView<>(objects);
table.setEditable(true); table.setEditable(true);
table.getColumns().setAll(enabledColumn, fileNameColumn, currentVersionColumn, targetVersionColumn, sourceColumn); table.getColumns().setAll(enabledColumn, fileNameColumn, currentVersionColumn, targetVersionColumn, sourceColumn);
setMargin(table, new Insets(10, 10, 5, 10));
setCenter(table); setCenter(table);

View File

@@ -1508,6 +1508,63 @@
-fx-background-color: -monet-on-surface; -fx-background-color: -monet-on-surface;
} }
/*******************************************************************************
* *
* Table View *
* *
******************************************************************************/
/* WE DEFINITELY NEED JFX TABLE-VIEW */
.table-view {
-fx-padding: 3;
-fx-background-color: -monet-surface-container-low;
}
.table-view,
.table-view .column-header,
.table-view .filler,
.table-view .column-header-background,
.table-row-cell {
-fx-background-radius: 6;
-fx-border-radius: 6;
}
.table-view .column-header,
.table-view .filler {
-fx-background-color: transparent;
}
.table-view .column-header-background {
-fx-background-color: -monet-surface-container-highest;
}
.table-row-cell {
-fx-background-color: -monet-surface-container;
-fx-table-cell-border-color: -monet-surface-container-lowest;
}
.table-row-cell:odd {
-fx-background-color: -monet-surface-container-high;
}
.table-cell {
-fx-background-color: transparent;
-fx-text-fill: -monet-on-surface;
}
.table-view > .virtual-flow > .clipped-container > .sheet > .table-row-cell:filled:selected {
-fx-background-color: -monet-secondary-container;
}
.table-view > .virtual-flow > .scroll-bar {
-fx-skin: "org.jackhuang.hmcl.ui.construct.FloatScrollBarSkin";
}
.table-view > .virtual-flow > .scroll-bar .track {
-fx-fill: transparent;
}
/******************************************************************************* /*******************************************************************************
* * * *
* JFX Decorator * * JFX Decorator *