Set cursor in button to hand by default

This commit is contained in:
huanghongxun 2019-02-17 13:57:49 +08:00
parent 9062c2e447
commit 88f6fd1965
10 changed files with 27 additions and 26 deletions

View File

@ -70,7 +70,7 @@ public class ListPageSkin extends SkinBase<ListPage<?>> {
JFXButton btnAdd = new JFXButton(); JFXButton btnAdd = new JFXButton();
FXUtils.setLimitWidth(btnAdd, 40); FXUtils.setLimitWidth(btnAdd, 40);
FXUtils.setLimitHeight(btnAdd, 40); FXUtils.setLimitHeight(btnAdd, 40);
btnAdd.getStyleClass().setAll("jfx-button-raised-round"); btnAdd.getStyleClass().add("jfx-button-raised-round");
btnAdd.setButtonType(JFXButton.ButtonType.RAISED); btnAdd.setButtonType(JFXButton.ButtonType.RAISED);
btnAdd.setGraphic(SVG.plus(Theme.whiteFillBinding(), -1, -1)); btnAdd.setGraphic(SVG.plus(Theme.whiteFillBinding(), -1, -1));
btnAdd.setOnMouseClicked(e -> skinnable.add()); btnAdd.setOnMouseClicked(e -> skinnable.add());
@ -78,7 +78,7 @@ public class ListPageSkin extends SkinBase<ListPage<?>> {
JFXButton btnRefresh = new JFXButton(); JFXButton btnRefresh = new JFXButton();
FXUtils.setLimitWidth(btnRefresh, 40); FXUtils.setLimitWidth(btnRefresh, 40);
FXUtils.setLimitHeight(btnRefresh, 40); FXUtils.setLimitHeight(btnRefresh, 40);
btnRefresh.getStyleClass().setAll("jfx-button-raised-round"); btnRefresh.getStyleClass().add("jfx-button-raised-round");
btnRefresh.setButtonType(JFXButton.ButtonType.RAISED); btnRefresh.setButtonType(JFXButton.ButtonType.RAISED);
btnRefresh.setGraphic(SVG.refresh(Theme.whiteFillBinding(), -1, -1)); btnRefresh.setGraphic(SVG.refresh(Theme.whiteFillBinding(), -1, -1));
btnRefresh.setOnMouseClicked(e -> skinnable.refresh()); btnRefresh.setOnMouseClicked(e -> skinnable.refresh());

View File

@ -83,7 +83,7 @@ public abstract class SettingsView extends StackPane {
lblUpdate = new Label(i18n("update")); lblUpdate = new Label(i18n("update"));
lblUpdateSub = new Label(); lblUpdateSub = new Label();
lblUpdateSub.getStyleClass().setAll("subtitle-label"); lblUpdateSub.getStyleClass().add("subtitle-label");
headerLeft.getChildren().setAll(lblUpdate, lblUpdateSub); headerLeft.getChildren().setAll(lblUpdate, lblUpdateSub);
updatePane.setHeaderLeft(headerLeft); updatePane.setHeaderLeft(headerLeft);
@ -92,7 +92,7 @@ public abstract class SettingsView extends StackPane {
{ {
btnUpdate = new JFXButton(); btnUpdate = new JFXButton();
btnUpdate.setOnMouseClicked(e -> onUpdate()); btnUpdate.setOnMouseClicked(e -> onUpdate());
btnUpdate.getStyleClass().setAll("toggle-icon4"); btnUpdate.getStyleClass().add("toggle-icon4");
btnUpdate.setGraphic(SVG.update(Theme.blackFillBinding(), 20, 20)); btnUpdate.setGraphic(SVG.update(Theme.blackFillBinding(), 20, 20));
updatePane.setHeaderRight(btnUpdate); updatePane.setHeaderRight(btnUpdate);
@ -124,7 +124,7 @@ public abstract class SettingsView extends StackPane {
Label help = new Label(i18n("help")); Label help = new Label(i18n("help"));
Label helpSubtitle = new Label(i18n("help.detail")); Label helpSubtitle = new Label(i18n("help.detail"));
helpSubtitle.getStyleClass().setAll("subtitle-label"); helpSubtitle.getStyleClass().add("subtitle-label");
headerLeft.getChildren().setAll(help, helpSubtitle); headerLeft.getChildren().setAll(help, helpSubtitle);
updatePane.setLeft(headerLeft); updatePane.setLeft(headerLeft);
@ -133,7 +133,7 @@ public abstract class SettingsView extends StackPane {
{ {
JFXButton btnExternal = new JFXButton(); JFXButton btnExternal = new JFXButton();
btnExternal.setOnMouseClicked(e -> onHelp()); btnExternal.setOnMouseClicked(e -> onHelp());
btnExternal.getStyleClass().setAll("toggle-icon4"); btnExternal.getStyleClass().add("toggle-icon4");
btnExternal.setGraphic(SVG.openInNew(Theme.blackFillBinding(), -1, -1)); btnExternal.setGraphic(SVG.openInNew(Theme.blackFillBinding(), -1, -1));
updatePane.setRight(btnExternal); updatePane.setRight(btnExternal);
@ -337,7 +337,7 @@ public abstract class SettingsView extends StackPane {
{ {
JFXButton logButton = new JFXButton(i18n("settings.launcher.launcher_log.export")); JFXButton logButton = new JFXButton(i18n("settings.launcher.launcher_log.export"));
logButton.setOnMouseClicked(e -> onExportLogs()); logButton.setOnMouseClicked(e -> onExportLogs());
logButton.getStyleClass().setAll("jfx-button-border"); logButton.getStyleClass().add("jfx-button-border");
logPane.setHeaderRight(logButton); logPane.setHeaderRight(logButton);
} }

View File

@ -83,7 +83,7 @@ public class AdvancedListItemSkin extends SkinBase<AdvancedListItem> {
HBox right = new HBox(); HBox right = new HBox();
right.setAlignment(Pos.CENTER); right.setAlignment(Pos.CENTER);
right.setMouseTransparent(true); right.setMouseTransparent(true);
right.getStyleClass().setAll("toggle-icon4"); right.getStyleClass().add("toggle-icon4");
FXUtils.setLimitWidth(right, 40); FXUtils.setLimitWidth(right, 40);
FXUtils.onChangeAndOperate(skinnable.rightGraphicProperty(), FXUtils.onChangeAndOperate(skinnable.rightGraphicProperty(),
newGraphic -> { newGraphic -> {
@ -99,7 +99,7 @@ public class AdvancedListItemSkin extends SkinBase<AdvancedListItem> {
visible -> root.setRight(visible ? right : null)); visible -> root.setRight(visible ? right : null));
stackPane.setStyle("-fx-padding: 10 16 10 16;"); stackPane.setStyle("-fx-padding: 10 16 10 16;");
stackPane.getStyleClass().setAll("transparent"); stackPane.getStyleClass().add("transparent");
stackPane.setPickOnBounds(false); stackPane.setPickOnBounds(false);
stackPane.getChildren().setAll(root); stackPane.getChildren().setAll(root);

View File

@ -45,7 +45,7 @@ public class IconedItem extends RipplerContainer {
hBox.getChildren().add(icon); hBox.getChildren().add(icon);
} }
hBox.getStyleClass().setAll("iconed-item-container"); hBox.getStyleClass().add("iconed-item-container");
Label textLabel = new Label(); Label textLabel = new Label();
textLabel.setId("label"); textLabel.setId("label");
textLabel.setMouseTransparent(true); textLabel.setMouseTransparent(true);

View File

@ -64,7 +64,7 @@ public class PopupMenu extends Control {
public static Node wrapPopupMenuItem(Node node) { public static Node wrapPopupMenuItem(Node node) {
StackPane pane = new StackPane(); StackPane pane = new StackPane();
pane.getChildren().setAll(node); pane.getChildren().setAll(node);
pane.getStyleClass().setAll("menu-container"); pane.getStyleClass().add("menu-container");
node.setMouseTransparent(true); node.setMouseTransparent(true);
return new RipplerContainer(pane); return new RipplerContainer(pane);
} }

View File

@ -73,7 +73,7 @@ public class DecoratorSkin extends SkinBase<Decorator> {
Decorator skinnable = getSkinnable(); Decorator skinnable = getSkinnable();
BorderPane root = new BorderPane(); BorderPane root = new BorderPane();
root.getStyleClass().setAll("jfx-decorator", "resize-border"); root.getStyleClass().addAll("jfx-decorator", "resize-border");
root.setPrefHeight(519); root.setPrefHeight(519);
root.setPrefWidth(800); root.setPrefWidth(800);
root.setMaxHeight(Region.USE_PREF_SIZE); root.setMaxHeight(Region.USE_PREF_SIZE);
@ -83,7 +83,7 @@ public class DecoratorSkin extends SkinBase<Decorator> {
StackPane drawerWrapper = new StackPane(); StackPane drawerWrapper = new StackPane();
skinnable.setDrawerWrapper(drawerWrapper); skinnable.setDrawerWrapper(drawerWrapper);
drawerWrapper.getStyleClass().setAll("jfx-decorator-drawer"); drawerWrapper.getStyleClass().add("jfx-decorator-drawer");
drawerWrapper.backgroundProperty().bind(skinnable.backgroundProperty()); drawerWrapper.backgroundProperty().bind(skinnable.backgroundProperty());
FXUtils.setOverflowHidden(drawerWrapper, true); FXUtils.setOverflowHidden(drawerWrapper, true);
{ {
@ -92,10 +92,10 @@ public class DecoratorSkin extends SkinBase<Decorator> {
{ {
BorderPane leftRootPane = new BorderPane(); BorderPane leftRootPane = new BorderPane();
FXUtils.setLimitWidth(leftRootPane, 200); FXUtils.setLimitWidth(leftRootPane, 200);
leftRootPane.getStyleClass().setAll("jfx-decorator-content-container"); leftRootPane.getStyleClass().add("jfx-decorator-content-container");
StackPane drawerContainer = new StackPane(); StackPane drawerContainer = new StackPane();
drawerContainer.getStyleClass().setAll("gray-background"); drawerContainer.getStyleClass().add("gray-background");
Bindings.bindContent(drawerContainer.getChildren(), skinnable.drawerProperty()); Bindings.bindContent(drawerContainer.getChildren(), skinnable.drawerProperty());
leftRootPane.setCenter(drawerContainer); leftRootPane.setCenter(drawerContainer);
@ -111,7 +111,7 @@ public class DecoratorSkin extends SkinBase<Decorator> {
{ {
contentPlaceHolder = new StackPane(); contentPlaceHolder = new StackPane();
contentPlaceHolder.getStyleClass().setAll("jfx-decorator-content-container"); contentPlaceHolder.getStyleClass().add("jfx-decorator-content-container");
contentPlaceHolder.backgroundProperty().bind(skinnable.contentBackgroundProperty()); contentPlaceHolder.backgroundProperty().bind(skinnable.contentBackgroundProperty());
FXUtils.setOverflowHidden(contentPlaceHolder, true); FXUtils.setOverflowHidden(contentPlaceHolder, true);
Bindings.bindContent(contentPlaceHolder.getChildren(), skinnable.contentProperty()); Bindings.bindContent(contentPlaceHolder.getChildren(), skinnable.contentProperty());
@ -189,14 +189,14 @@ public class DecoratorSkin extends SkinBase<Decorator> {
{ {
JFXButton backNavButton = new JFXButton(); JFXButton backNavButton = new JFXButton();
backNavButton.setGraphic(SVG.back(Theme.foregroundFillBinding(), -1, -1)); backNavButton.setGraphic(SVG.back(Theme.foregroundFillBinding(), -1, -1));
backNavButton.getStyleClass().setAll("jfx-decorator-button"); backNavButton.getStyleClass().add("jfx-decorator-button");
backNavButton.ripplerFillProperty().bind(Theme.whiteFillBinding()); backNavButton.ripplerFillProperty().bind(Theme.whiteFillBinding());
backNavButton.onActionProperty().bind(skinnable.onBackNavButtonActionProperty()); backNavButton.onActionProperty().bind(skinnable.onBackNavButtonActionProperty());
backNavButton.visibleProperty().bind(skinnable.canBackProperty()); backNavButton.visibleProperty().bind(skinnable.canBackProperty());
closeNavButton = new JFXButton(); closeNavButton = new JFXButton();
closeNavButton.setGraphic(SVG.close(Theme.foregroundFillBinding(), -1, -1)); closeNavButton.setGraphic(SVG.close(Theme.foregroundFillBinding(), -1, -1));
closeNavButton.getStyleClass().setAll("jfx-decorator-button"); closeNavButton.getStyleClass().add("jfx-decorator-button");
closeNavButton.ripplerFillProperty().bind(Theme.whiteFillBinding()); closeNavButton.ripplerFillProperty().bind(Theme.whiteFillBinding());
closeNavButton.onActionProperty().bind(skinnable.onCloseNavButtonActionProperty()); closeNavButton.onActionProperty().bind(skinnable.onCloseNavButtonActionProperty());
@ -219,7 +219,7 @@ public class DecoratorSkin extends SkinBase<Decorator> {
VBox navCenter = new VBox(); VBox navCenter = new VBox();
navCenter.setAlignment(Pos.CENTER_LEFT); navCenter.setAlignment(Pos.CENTER_LEFT);
Label titleLabel = new Label(); Label titleLabel = new Label();
titleLabel.getStyleClass().setAll("jfx-decorator-title"); titleLabel.getStyleClass().add("jfx-decorator-title");
titleLabel.textProperty().bind(skinnable.drawerTitleProperty()); titleLabel.textProperty().bind(skinnable.drawerTitleProperty());
navCenter.getChildren().setAll(titleLabel); navCenter.getChildren().setAll(titleLabel);
navBar.setCenter(navCenter); navBar.setCenter(navCenter);
@ -228,7 +228,7 @@ public class DecoratorSkin extends SkinBase<Decorator> {
navRight.setAlignment(Pos.CENTER_RIGHT); navRight.setAlignment(Pos.CENTER_RIGHT);
refreshNavButton = new JFXButton(); refreshNavButton = new JFXButton();
refreshNavButton.setGraphic(SVG.refresh(Theme.foregroundFillBinding(), -1, -1)); refreshNavButton.setGraphic(SVG.refresh(Theme.foregroundFillBinding(), -1, -1));
refreshNavButton.getStyleClass().setAll("jfx-decorator-button"); refreshNavButton.getStyleClass().add("jfx-decorator-button");
refreshNavButton.ripplerFillProperty().bind(Theme.whiteFillBinding()); refreshNavButton.ripplerFillProperty().bind(Theme.whiteFillBinding());
refreshNavButton.onActionProperty().bind(skinnable.onRefreshNavButtonActionProperty()); refreshNavButton.onActionProperty().bind(skinnable.onRefreshNavButtonActionProperty());
refreshNavButton.visibleProperty().bind(skinnable.canRefreshProperty()); refreshNavButton.visibleProperty().bind(skinnable.canRefreshProperty());
@ -251,12 +251,12 @@ public class DecoratorSkin extends SkinBase<Decorator> {
StackPane pane = new StackPane(minus); StackPane pane = new StackPane(minus);
pane.setAlignment(Pos.CENTER); pane.setAlignment(Pos.CENTER);
btnMin.setGraphic(pane); btnMin.setGraphic(pane);
btnMin.getStyleClass().setAll("jfx-decorator-button"); btnMin.getStyleClass().add("jfx-decorator-button");
btnMin.setOnAction(e -> skinnable.minimize()); btnMin.setOnAction(e -> skinnable.minimize());
JFXButton btnClose = new JFXButton(); JFXButton btnClose = new JFXButton();
btnClose.setGraphic(SVG.close(Theme.foregroundFillBinding(), -1, -1)); btnClose.setGraphic(SVG.close(Theme.foregroundFillBinding(), -1, -1));
btnClose.getStyleClass().setAll("jfx-decorator-button"); btnClose.getStyleClass().add("jfx-decorator-button");
btnClose.setOnAction(e -> skinnable.close()); btnClose.setOnAction(e -> skinnable.close());
buttonsContainer.getChildren().setAll(separator, btnMin, btnClose); buttonsContainer.getChildren().setAll(separator, btnMin, btnClose);

View File

@ -52,7 +52,7 @@ public class DecoratorWizardDisplayer extends StackPane implements TaskExecutorD
wizardController.setProvider(provider); wizardController.setProvider(provider);
wizardController.onStart(); wizardController.onStart();
getStyleClass().setAll("white-background"); getStyleClass().add("white-background");
} }
@Override @Override

View File

@ -50,7 +50,7 @@ public class GameListSkin extends SkinBase<GameList> {
{ {
HBox toolbar = new HBox(); HBox toolbar = new HBox();
toolbar.getStyleClass().setAll("jfx-tool-bar-second"); toolbar.getStyleClass().add("jfx-tool-bar-second");
JFXDepthManager.setDepth(toolbar, 1); JFXDepthManager.setDepth(toolbar, 1);
toolbar.setPickOnBounds(false); toolbar.setPickOnBounds(false);

View File

@ -58,7 +58,7 @@ public class ModListPageSkin extends SkinBase<ModListPage> {
{ {
HBox toolbar = new HBox(); HBox toolbar = new HBox();
toolbar.getStyleClass().setAll("jfx-tool-bar-second"); toolbar.getStyleClass().add("jfx-tool-bar-second");
JFXDepthManager.setDepth(toolbar, 1); JFXDepthManager.setDepth(toolbar, 1);
toolbar.setPickOnBounds(false); toolbar.setPickOnBounds(false);

View File

@ -346,7 +346,7 @@
} }
.jfx-tool-bar .jfx-decorator-button { .jfx-tool-bar .jfx-decorator-button {
-fx-cursor: head; -fx-cursor: hand;
} }
.jfx-tool-bar Label { .jfx-tool-bar Label {
@ -504,6 +504,7 @@
.jfx-button { .jfx-button {
-jfx-disable-visual-focus: true; -jfx-disable-visual-focus: true;
-fx-cursor: hand;
} }
.jfx-button-raised { .jfx-button-raised {