Skip to content

Commit 5e21fad

Browse files
committed
feat: using the theme AtlantaFX
used temporarily, might discard fxml for better support
1 parent d26bb5d commit 5e21fad

File tree

5 files changed

+43
-12
lines changed

5 files changed

+43
-12
lines changed

pom.xml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,13 @@
3838
<artifactId>log4j-core</artifactId>
3939
<version>2.24.3</version>
4040
</dependency>
41+
42+
<!-- AtlantaFX -->
43+
<dependency>
44+
<groupId>io.github.mkpaz</groupId>
45+
<artifactId>atlantafx-base</artifactId>
46+
<version>2.0.1</version>
47+
</dependency>
4148
</dependencies>
4249

4350
<build>

src/main/java/chiloven/xamlsorter/Main.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
package chiloven.xamlsorter;
22

3+
import atlantafx.base.theme.CupertinoDark;
4+
import atlantafx.base.theme.CupertinoLight;
35
import chiloven.xamlsorter.controllers.MainController;
46
import chiloven.xamlsorter.modules.I18n;
57
import chiloven.xamlsorter.modules.PreferencesManager;
@@ -40,6 +42,9 @@ public void start(Stage primaryStage) {
4042
logger.info("Starting xamlSorter.Java application");
4143
FXMLLoader loader = new FXMLLoader(getClass().getResource("/ui/pages/MainPage.fxml"));
4244

45+
Application.setUserAgentStylesheet(new CupertinoLight().getUserAgentStylesheet());
46+
// Application.setUserAgentStylesheet(new CupertinoDark().getUserAgentStylesheet());
47+
4348
PreferencesManager.reload();
4449
String lang = PreferencesManager.get("language", "en");
4550
I18n.setLocale(lang);

src/main/resources/log4j2.xml

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,15 +3,17 @@
33
<Appenders>
44

55
<Console name="Console" target="SYSTEM_OUT">
6-
<PatternLayout pattern="[%d{HH:mm:ss.SSS}] [%replace{%t}{^JavaFX Application Thread$}{JFX App Thread}/%replace{%logger}{^chiloven\.xamlsorter\.}{}/%highlight{%level}]: %msg%n"
7-
disableAnsi="false" noConsoleNoAnsi="false"/>
6+
<PatternLayout
7+
pattern="[%d{HH:mm:ss.SSS}] [%replace{%t}{^JavaFX Application Thread$}{JFX App Thread}/%replace{%logger}{^chiloven\.xamlsorter\.}{}/%highlight{%level}]: %msg%n"
8+
disableAnsi="false" noConsoleNoAnsi="false"/>
89
</Console>
910

1011
<RollingFile name="RollingFile"
1112
fileName="logs/latest.log"
1213
filePattern="logs/%d{yyyy-MM-dd}-%i.log.gz"
1314
append="true">
14-
<PatternLayout pattern="[%d{yyyy-MM-dd HH:mm:ss.SSS}] [%replace{%t}{^JavaFX Application Thread$}{JFX App Thread}/%replace{%logger}{^chiloven\.xamlsorter\.}{}/%highlight{%level}]: %msg%n"/>
15+
<PatternLayout
16+
pattern="[%d{yyyy-MM-dd HH:mm:ss.SSS}] [%replace{%t}{^JavaFX Application Thread$}{JFX App Thread}/%replace{%logger}{^chiloven\.xamlsorter\.}{}/%highlight{%level}]: %msg%n"/>
1517
<Filters>
1618
<ThresholdFilter level="info" onMatch="ACCEPT" onMismatch="DENY"/>
1719
</Filters>

src/main/resources/ui/pages/MainPage.fxml

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,8 @@
44
<?import javafx.scene.control.*?>
55
<?import javafx.scene.layout.*?>
66
<StackPane xmlns:fx="http://javafx.com/fxml/1" fx:id="rootPane" prefHeight="600.0" prefWidth="800.0"
7-
xmlns="http://javafx.com/javafx/17.0.12" fx:controller="chiloven.xamlsorter.controllers.MainController">
7+
stylesheets="@../styles/startpane-temp.css" xmlns="http://javafx.com/javafx/17.0.12"
8+
fx:controller="chiloven.xamlsorter.controllers.MainController">
89
<VBox>
910
<fx:include fx:id="topMenuBar" source="/ui/widgets/TopMenuBar.fxml"/>
1011
<VBox fx:id="editorBox" VBox.vgrow="ALWAYS">
@@ -30,14 +31,10 @@
3031
</VBox>
3132

3233
<!-- Overlay -->
33-
<StackPane fx:id="welcomeOverlay" pickOnBounds="false" style="-fx-background-color: transparent;">
34-
<!-- Transparent background -->
35-
<Pane prefHeight="9999" prefWidth="9999" style="-fx-background-color: rgba(0,0,0,0.28);"
36-
StackPane.alignment="CENTER"/>
37-
<!-- Welcome box -->
38-
<VBox alignment="CENTER" maxHeight="350" maxWidth="370" spacing="18.0"
39-
style="-fx-background-color: white; -fx-background-radius: 8px; -fx-padding: 40 50;">
40-
<Label style="-fx-font-size:28px; -fx-font-weight:bold;" text="%general.application.name"/>
34+
<StackPane fx:id="welcomeOverlay" pickOnBounds="false" styleClass="welcome-overlay">
35+
<Pane prefHeight="9999" prefWidth="9999" StackPane.alignment="CENTER" styleClass="overlay-background"/>
36+
<VBox alignment="CENTER" maxHeight="350" maxWidth="370" spacing="18.0" styleClass="welcome-box">
37+
<Label styleClass="welcome-title" text="%general.application.name"/>
4138
<Separator prefWidth="200.0"/>
4239
<VBox spacing="18.0">
4340
<children>
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
.welcome-overlay {
2+
-fx-background-color: transparent;
3+
}
4+
5+
.overlay-background {
6+
-fx-background-color: rgba(0, 0, 0, 0.28);
7+
}
8+
9+
.welcome-box {
10+
-fx-background-color: white;
11+
-fx-background-radius: 8px;
12+
-fx-padding: 40 50;
13+
-fx-effect: dropshadow(gaussian, rgba(0, 0, 0, 0.2), 10, 0, 0, 2);
14+
}
15+
16+
.welcome-title {
17+
-fx-font-size: 28px;
18+
-fx-font-weight: bold;
19+
-fx-effect: dropshadow(gaussian, rgba(0, 0, 0, 0.1), 5, 0, 0, 2);
20+
}

0 commit comments

Comments
 (0)