Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -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
*/
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -153,6 +155,22 @@ public JFXCustomColorPickerDialog(Window owner) {
paraTransition.play();
});

container.getChildren().add(tabs);

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

为什么这么多空行?

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
Copy link
Contributor Author

Choose a reason for hiding this comment

The 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) -> {
Expand Down Expand Up @@ -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();
Copy link
Contributor Author

Choose a reason for hiding this comment

The 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(() -> {
Expand Down Expand Up @@ -262,9 +282,6 @@ public JFXCustomColorPickerDialog(Window owner) {
});
};


container.getChildren().add(tabs);

this.getChildren().add(container);
this.setPadding(new Insets(0));

Expand Down
15 changes: 15 additions & 0 deletions HMCL/src/main/resources/assets/css/root.css
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Copy link
Contributor Author

Choose a reason for hiding this comment

The 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 *
Expand Down