Open
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
该 PR 通过为自定义颜色选择对话框增加显式的“确定 / 取消”操作,修复“点击关闭按钮也会应用颜色”的隐性行为,使“关闭/取消=放弃更改、确定/回车=应用更改”的交互更直观,关闭 #5767。
Changes:
- 将对话框右上角关闭按钮行为从“应用颜色”改为“直接关闭不应用”。
- 在自定义颜色对话框底部新增“确定 / 取消”按钮区,并接入现有 i18n 文案键。
- 为新增按钮区增加 CSS 样式(背景、内边距、右对齐)。
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| HMCL/src/main/resources/assets/css/root.css | 新增自定义颜色对话框底部 actions 区域样式类 |
| HMCL/src/main/java/com/jfoenix/skins/JFXCustomColorPickerDialog.java | 调整关闭按钮行为,并新增 OK/Cancel 显式操作按钮 |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
HMCL/src/main/java/com/jfoenix/skins/JFXCustomColorPickerDialog.java
Outdated
Show resolved
Hide resolved
Glavo
reviewed
Mar 17, 2026
| }); | ||
|
|
||
| container.getChildren().add(tabs); | ||
|
|
Contributor
There was a problem hiding this comment.
Pull request overview
该 PR 通过在自定义颜色选择对话框中引入显式的“确定/取消”按钮,并将窗口关闭按钮改为直接关闭(不再隐式应用颜色),来修复/规避用户在未确认情况下颜色被意外应用的问题(close #5767),使交互更直观可控。
Changes:
- 将自定义颜色对话框标题栏关闭按钮行为从“应用颜色”改为“直接关闭”
- 在对话框底部新增“确定/取消”操作区:确定应用颜色并触发保存逻辑,取消/关闭则不应用
- 为新增操作区与按钮新增 CSS 样式
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
| HMCL/src/main/resources/assets/css/root.css | 增加自定义颜色对话框底部 actions 区与按钮的样式规则 |
| HMCL/src/main/java/com/jfoenix/skins/JFXCustomColorPickerDialog.java | 调整关闭行为并新增 OK/Cancel 按钮区;OK 触发 updateColor,Cancel/关闭仅 close |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
+161
to
+173
| actionsHBox.getStyleClass().add("jfx-color-dialog-actions"); | ||
|
|
||
| JFXButton acceptButton = new JFXButton(i18n("button.ok")); | ||
| acceptButton.setOnAction(event -> updateColor()); | ||
| acceptButton.getStyleClass().add("jfx-color-dialog-accept"); | ||
|
|
||
| JFXButton cancelButton = new JFXButton(i18n("button.cancel")); | ||
| cancelButton.setOnAction(event -> close()); | ||
| cancelButton.getStyleClass().add("jfx-color-dialog-cancel"); | ||
|
|
||
| actionsHBox.getChildren().addAll(acceptButton, cancelButton); | ||
| container.getChildren().add(actionsHBox); | ||
|
|
Contributor
Author
There was a problem hiding this comment.
不需要,其他的也没有单独这么做过
| }, pane.backgroundProperty())); | ||
|
|
||
| acceptButton.textFillProperty().bind(Bindings.createObjectBinding(() -> { | ||
| return (Color) pane.getBackground().getFills().get(0).getFill(); |
| .custom-color-dialog .jfx-color-dialog-actions { | ||
| -fx-background-color: -monet-surface; | ||
| -fx-padding: 0.0 10.0 5.0 0.0; | ||
| -fx-alignment: center-right; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
close #5767
目前的自定义颜色选择对话框的逻辑是点击关闭按钮是触发更新,而Esc是直接关闭,但是我认为这种逻辑比较隐晦,如果用户想要放弃其更改,可能不知道Esc可能直接关闭而不更新
在这个PR中引入显式的操作按钮,并将关闭按钮的逻辑改为直接关闭。