diff --git a/README.md b/README.md index ad216b2..fe797af 100644 --- a/README.md +++ b/README.md @@ -7,9 +7,13 @@ JavaFX版本的ElementUi,您可以仅需一行代码而轻松美化您的JavaF For Java: ``` + Button button = new Button(); + ElementButtonKt.theme(button, ElementButton.grayButton); + Scene scene = new Scene(root); scene.getStylesheets().add(CssResources.globalCssFile); scene.getStylesheets().add(CssResources.buttonCssFile);//可选,用于每个组件可单独调整主题 + /* or: CssResourcesKt.themes(scene, (strings, cssResources) -> { @@ -18,6 +22,7 @@ For Java: return null; }); */ + primaryStage.setScene(scene); primaryStage.setTitle("ElementForJavaFX"); primaryStage.show(); diff --git a/src/main/resources/cloud_css/ElementFX.css b/src/main/resources/cloud_css/ElementFX.css index c14f98d..15cb9e8 100644 --- a/src/main/resources/cloud_css/ElementFX.css +++ b/src/main/resources/cloud_css/ElementFX.css @@ -1,13 +1,13 @@ .button { - -fx-background-color: rgba(236, 245, 255, 1); - -fx-background-radius: 5px 5px 5px 5px; - -fx-border-color: rgba(179, 216, 255, 1) rgba(179, 216, 255, 1) rgba(179, 216, 255, 1) rgba(179, 216, 255, 1); - -fx-border-radius: 5px 5px 5px 5px; - -fx-text-fill: rgba(64, 158, 255, 1); - -fx-font-size: 15px; - -fx-padding: 5px 10px 5px 10px; - -fx-cursor: HAND; - } + -fx-background-color: rgba(236, 245, 255, 1); + -fx-background-radius: 5px 5px 5px 5px; + -fx-border-color: rgba(179, 216, 255, 1) rgba(179, 216, 255, 1) rgba(179, 216, 255, 1) rgba(179, 216, 255, 1); + -fx-border-radius: 5px 5px 5px 5px; + -fx-text-fill: rgba(64, 158, 255, 1); + -fx-font-size: 15px; + -fx-padding: 5px 10px 5px 10px; + -fx-cursor: HAND; +} .button:hover { -fx-background-color: rgba(64, 158, 255, 1); -fx-border-color: rgba(64, 158, 255, 1) rgba(64, 158, 255, 1) rgba(64, 158, 255, 1) rgba(64, 158, 255, 1); @@ -365,7 +365,7 @@ .date-picker .text-field { -fx-border-color: rgba(0, 0, 0, 0) rgba(0, 0, 0, 0) rgba(0, 0, 0, 0) rgba(0, 0, 0, 0); } -.date-picker:hover, .date-picker:focused { +.date-picker:focused { -fx-border-color: rgba(64, 169, 255, 1) rgba(64, 169, 255, 1) rgba(64, 169, 255, 1) rgba(64, 169, 255, 1); } .table-view { diff --git a/src/test/java/mains.java b/src/test/java/mains.java index 2a3f80c..544b191 100644 --- a/src/test/java/mains.java +++ b/src/test/java/mains.java @@ -1,14 +1,21 @@ import ink.bluecloud.css.CssResources; +import ink.bluecloud.css.ElementButton; +import ink.bluecloud.css.ElementButtonKt; import javafx.application.Application; import javafx.scene.Scene; +import javafx.scene.control.Button; import javafx.scene.control.TextField; import javafx.stage.Stage; class mains extends Application { @Override public void start(Stage primaryStage) throws Exception { + Button button = new Button(); + ElementButtonKt.theme(button, ElementButton.grayButton); Scene scene = new Scene(new TextField()); scene.getStylesheets().add(CssResources.globalCssFile); + + primaryStage.setScene(scene); primaryStage.setTitle("ElementForJavaFX"); primaryStage.show(); diff --git a/src/test/kotlin/devapp/CloudStyleGlobal.kt b/src/test/kotlin/devapp/CloudStyleGlobal.kt index 6cc5f0e..d118106 100644 --- a/src/test/kotlin/devapp/CloudStyleGlobal.kt +++ b/src/test/kotlin/devapp/CloudStyleGlobal.kt @@ -1,6 +1,5 @@ package devapp -import javafx.scene.Cursor import javafx.scene.Cursor.HAND import javafx.scene.paint.Color import javafx.scene.paint.Color.* @@ -468,7 +467,7 @@ class CloudStyleGlobal:Stylesheet() { borderColor += box(TRANSPARENT) } - and(hover, focused) { + and(focused) { borderColor += box(c(64,169,255)) }