Skip to content

Commit

Permalink
fix: タイトルが表示されてなかったのを修正 (#79)
Browse files Browse the repository at this point in the history
* fix: タイトルが表示されなくなってたのを修正

* chore: propertyの初期化タイミングを変更

* chore: 変数名を変更

* chore: 変数名を変更

* メソッドを変更
  • Loading branch information
jiro4989 authored Dec 28, 2021
1 parent f228418 commit c6202c5
Showing 1 changed file with 17 additions and 16 deletions.
33 changes: 17 additions & 16 deletions src/main/kotlin/com/jiro4989/tkfm/Main.kt
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import javafx.scene.image.Image
import javafx.scene.layout.BorderPane
import javafx.stage.Stage

val title = "TKoolFacetileMaker2"
val applicationTitle = "TKoolFacetileMaker2"

/** プログラムのエントリーポイント */
fun main(args: Array<String>) {
Expand All @@ -22,11 +22,16 @@ class Main : Application() {
private lateinit var controller: MainViewController
private lateinit var root: BorderPane
private lateinit var stage: Stage
private val prop = WindowPropertiesModel()
private val windowProperty = WindowPropertiesModel()
private val applicationProperty = Properties()

override fun start(primaryStage: Stage) {
this.javaClass.getResourceAsStream("properties/application.properties")?.bufferedReader().use {
applicationProperty.load(it)
}
printApplicationInformation()
prop.load()

windowProperty.load()
stage = primaryStage
try {
val loader = FXMLLoader(this.javaClass.getResource("fxml/main_view.fxml"))
Expand All @@ -40,11 +45,11 @@ class Main : Application() {
stage.apply {
setScene(scene)
icons.add(Image(thisClass.getResource("img/logo.png").toExternalForm()))
setTitle(title)
setX(prop.x)
setY(prop.y)
setWidth(prop.width)
setHeight(prop.height)
setTitle(applicationTitle)
setX(windowProperty.x)
setY(windowProperty.y)
setWidth(windowProperty.width)
setHeight(windowProperty.height)
show()
}
} catch (e: Exception) {
Expand All @@ -54,7 +59,7 @@ class Main : Application() {

override fun stop() {
controller.storeProperties()
prop.apply {
windowProperty.apply {
x = stage.x
y = stage.y
width = stage.width
Expand All @@ -64,14 +69,10 @@ class Main : Application() {
}

fun printApplicationInformation() {
val property = Properties()
this.javaClass.getResourceAsStream("properties/application.properties")?.bufferedReader().use {
property.load(it)
}
val version = property.get("version")
val commitHash = property.get("commithash")
val version = applicationProperty.getProperty("version", "dev")
val commitHash = applicationProperty.getProperty("commithash", "dev")
println("--------------------------------------------")
println("application_name: $title")
println("application_name: $applicationTitle")
println("version: $version")
println("commit_hash: $commitHash")
println("document: README.txt")
Expand Down

0 comments on commit c6202c5

Please sign in to comment.