Skip to content

Commit b6d95c3

Browse files
authored
[Enhancement] 给 TableView 添加样式 (#4854)
1 parent 29e40ec commit b6d95c3

File tree

2 files changed

+58
-0
lines changed

2 files changed

+58
-0
lines changed

HMCL/src/main/java/org/jackhuang/hmcl/ui/versions/ModUpdatesPage.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,7 @@ public ModUpdatesPage(ModManager modManager, List<LocalModFile.ModUpdate> update
102102
TableView<ModUpdateObject> table = new TableView<>(objects);
103103
table.setEditable(true);
104104
table.getColumns().setAll(enabledColumn, fileNameColumn, currentVersionColumn, targetVersionColumn, sourceColumn);
105+
setMargin(table, new Insets(10, 10, 5, 10));
105106

106107
setCenter(table);
107108

HMCL/src/main/resources/assets/css/root.css

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1508,6 +1508,63 @@
15081508
-fx-background-color: -monet-on-surface;
15091509
}
15101510

1511+
/*******************************************************************************
1512+
* *
1513+
* Table View *
1514+
* *
1515+
******************************************************************************/
1516+
1517+
/* WE DEFINITELY NEED JFX TABLE-VIEW */
1518+
1519+
.table-view {
1520+
-fx-padding: 3;
1521+
-fx-background-color: -monet-surface-container-low;
1522+
}
1523+
1524+
.table-view,
1525+
.table-view .column-header,
1526+
.table-view .filler,
1527+
.table-view .column-header-background,
1528+
.table-row-cell {
1529+
-fx-background-radius: 6;
1530+
-fx-border-radius: 6;
1531+
}
1532+
1533+
.table-view .column-header,
1534+
.table-view .filler {
1535+
-fx-background-color: transparent;
1536+
}
1537+
1538+
.table-view .column-header-background {
1539+
-fx-background-color: -monet-surface-container-highest;
1540+
}
1541+
1542+
.table-row-cell {
1543+
-fx-background-color: -monet-surface-container;
1544+
-fx-table-cell-border-color: -monet-surface-container-lowest;
1545+
}
1546+
1547+
.table-row-cell:odd {
1548+
-fx-background-color: -monet-surface-container-high;
1549+
}
1550+
1551+
.table-cell {
1552+
-fx-background-color: transparent;
1553+
-fx-text-fill: -monet-on-surface;
1554+
}
1555+
1556+
.table-view > .virtual-flow > .clipped-container > .sheet > .table-row-cell:filled:selected {
1557+
-fx-background-color: -monet-secondary-container;
1558+
}
1559+
1560+
.table-view > .virtual-flow > .scroll-bar {
1561+
-fx-skin: "org.jackhuang.hmcl.ui.construct.FloatScrollBarSkin";
1562+
}
1563+
1564+
.table-view > .virtual-flow > .scroll-bar .track {
1565+
-fx-fill: transparent;
1566+
}
1567+
15111568
/*******************************************************************************
15121569
* *
15131570
* JFX Decorator *

0 commit comments

Comments
 (0)