-
Notifications
You must be signed in to change notification settings - Fork 847
feat: 为自定义颜色选择对话框添加显式的确认和取消按钮 #5775
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
050d2ed
a930d79
128011a
44c8fb4
79b71d8
b23b8c2
a993828
8899dbf
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -46,6 +46,8 @@ | |
| import java.util.concurrent.atomic.AtomicInteger; | ||
| import java.util.regex.Pattern; | ||
|
|
||
| import static org.jackhuang.hmcl.util.i18n.I18n.i18n; | ||
|
|
||
| /** | ||
| * @author Shadi Shaheen | ||
| */ | ||
|
|
@@ -78,7 +80,7 @@ public JFXCustomColorPickerDialog(Window owner) { | |
|
|
||
| // create JFX Decorator | ||
| pickerDecorator = new JFXDecorator(dialog, this, false, false, false); | ||
| pickerDecorator.setOnCloseButtonAction(this::updateColor); | ||
| pickerDecorator.setOnCloseButtonAction(this::close); | ||
| pickerDecorator.setPickOnBounds(false); | ||
| customScene = new Scene(pickerDecorator, Color.TRANSPARENT); | ||
| StyleSheets.init(customScene); | ||
|
|
@@ -153,6 +155,22 @@ public JFXCustomColorPickerDialog(Window owner) { | |
| paraTransition.play(); | ||
| }); | ||
|
|
||
| container.getChildren().add(tabs); | ||
|
|
||
| HBox actionsHBox = new HBox(); | ||
| 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); | ||
|
|
||
|
Comment on lines
+161
to
+173
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 不需要,其他的也没有单独这么做过 |
||
| initRun = () -> { | ||
| // change tabs labels font color according to the selected color | ||
| pane.backgroundProperty().addListener((o, oldVal, newVal) -> { | ||
|
|
@@ -232,7 +250,9 @@ public JFXCustomColorPickerDialog(Window owner) { | |
| hexField.focusColorProperty().bind(Bindings.createObjectBinding(() -> { | ||
| return pane.getBackground().getFills().get(0).getFill(); | ||
| }, pane.backgroundProperty())); | ||
|
|
||
| acceptButton.textFillProperty().bind(Bindings.createObjectBinding(() -> { | ||
| return (Color) pane.getBackground().getFills().get(0).getFill(); | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 不存在这种问题 |
||
| }, pane.backgroundProperty())); | ||
|
|
||
| ((Pane) pickerDecorator.lookup(".jfx-decorator-buttons-container")).backgroundProperty() | ||
| .bind(Bindings.createObjectBinding(() -> { | ||
|
|
@@ -262,9 +282,6 @@ public JFXCustomColorPickerDialog(Window owner) { | |
| }); | ||
| }; | ||
|
|
||
|
|
||
| container.getChildren().add(tabs); | ||
|
|
||
| this.getChildren().add(container); | ||
| this.setPadding(new Insets(0)); | ||
|
|
||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -1635,6 +1635,21 @@ | |
| -fx-background-color: -monet-on-surface; | ||
| } | ||
|
|
||
| .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; | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 本来按钮就有默认的距离的 |
||
| } | ||
|
|
||
| .custom-color-dialog .jfx-color-dialog-accept { | ||
| -fx-padding: 0.7em 0.8em; | ||
| } | ||
|
|
||
| .custom-color-dialog .jfx-color-dialog-cancel { | ||
| -fx-text-fill: -monet-on-surface-variant; | ||
| -fx-padding: 0.7em 0.8em; | ||
| } | ||
|
|
||
| /******************************************************************************* | ||
| * * | ||
| * Table View * | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
为什么这么多空行?