From b6d95c3ebb1668fbeb2136ad489ab0f6ebf1d16d Mon Sep 17 00:00:00 2001 From: Calboot Date: Fri, 12 Dec 2025 22:00:55 +0800 Subject: [PATCH] =?UTF-8?q?[Enhancement]=20=E7=BB=99=20TableView=20?= =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E6=A0=B7=E5=BC=8F=20(#4854)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../hmcl/ui/versions/ModUpdatesPage.java | 1 + HMCL/src/main/resources/assets/css/root.css | 57 +++++++++++++++++++ 2 files changed, 58 insertions(+) diff --git a/HMCL/src/main/java/org/jackhuang/hmcl/ui/versions/ModUpdatesPage.java b/HMCL/src/main/java/org/jackhuang/hmcl/ui/versions/ModUpdatesPage.java index 00be5bf69..abf8d68f6 100644 --- a/HMCL/src/main/java/org/jackhuang/hmcl/ui/versions/ModUpdatesPage.java +++ b/HMCL/src/main/java/org/jackhuang/hmcl/ui/versions/ModUpdatesPage.java @@ -102,6 +102,7 @@ public class ModUpdatesPage extends BorderPane implements DecoratorPage { TableView table = new TableView<>(objects); table.setEditable(true); table.getColumns().setAll(enabledColumn, fileNameColumn, currentVersionColumn, targetVersionColumn, sourceColumn); + setMargin(table, new Insets(10, 10, 5, 10)); setCenter(table); diff --git a/HMCL/src/main/resources/assets/css/root.css b/HMCL/src/main/resources/assets/css/root.css index 2bb6cf173..5b0ade9c9 100644 --- a/HMCL/src/main/resources/assets/css/root.css +++ b/HMCL/src/main/resources/assets/css/root.css @@ -1508,6 +1508,63 @@ -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 *