This commit is contained in:
death-claw
2024-01-07 15:57:13 +01:00
parent 81cf97cc50
commit 6f641e29b6
3 changed files with 21 additions and 6 deletions
+5
View File
@@ -97,6 +97,11 @@
<groupId>no.tornado</groupId>
<version>1.7.20</version>
</dependency>
<dependency>
<artifactId>materialfx</artifactId>
<groupId>io.github.palexdev</groupId>
<version>11.17.0</version>
</dependency>
<dependency>
<artifactId>vripper-core</artifactId>
<groupId>me.vripper</groupId>
@@ -1,5 +1,8 @@
package me.vripper.gui
import io.github.palexdev.materialfx.theming.JavaFXThemes
import io.github.palexdev.materialfx.theming.MaterialFXStylesheets
import io.github.palexdev.materialfx.theming.UserAgentBuilder
import javafx.application.Application
import javafx.scene.image.Image
import javafx.stage.Stage
@@ -13,9 +16,7 @@ import me.vripper.utilities.DbUtils
import org.jetbrains.exposed.sql.Database
import org.koin.core.context.GlobalContext
import org.koin.core.context.startKoin
import tornadofx.App
import tornadofx.DIContainer
import tornadofx.FX
import tornadofx.*
import kotlin.reflect.KClass
import kotlin.system.exitProcess
@@ -32,6 +33,13 @@ class VripperGuiApplication : App(
}
override fun start(stage: Stage) {
UserAgentBuilder.builder()
.themes(JavaFXThemes.MODENA) // Optional if you don't need JavaFX's default theme, still recommended though
.themes(MaterialFXStylesheets.forAssemble(true)) // Adds the MaterialFX's default theme. The boolean argument is to include legacy controls
.setDeploy(true) // Whether to deploy each theme's assets on a temporary dir on the disk
.setResolveAssets(true) // Whether to try resolving @import statements and resources urls
.build() // Assembles all the added themes into a single CSSFragment (very powerful class check its documentation)
.setGlobal(); // Finally, sets the produced stylesheet as the global User-Agent stylesheet
with(stage) {
width = 1366.0
height = 768.0
@@ -1,5 +1,7 @@
package me.vripper.gui.view.settings
import io.github.palexdev.materialfx.controls.MFXButton
import io.github.palexdev.materialfx.enums.ButtonType
import javafx.geometry.Pos
import javafx.scene.control.Alert
import javafx.scene.control.TabPane
@@ -53,7 +55,8 @@ class SettingsView : Fragment("Settings") {
borderpane {
right {
padding = insets(all = 5.0)
button("Save") {
MFXButton("Save").apply {
buttonType = ButtonType.RAISED
imageview("save.png") {
fitWidth = 18.0
fitHeight = 18.0
@@ -70,9 +73,8 @@ class SettingsView : Fragment("Settings") {
} catch (e: ValidationException) {
alert(Alert.AlertType.ERROR, "Invalid settings", e.message)
}
}
}
}.attachTo(this)
}
}
}