aboutsummaryrefslogtreecommitdiff
path: root/src/main/kotlin/xyz/brysonsteck/ServerCraft/dialogs/KillDialog.kt
blob: 5ef0bbc53b8f485d4d694889b130389e2f6d1631 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
package xyz.brysonsteck.ServerCraft.dialogs

import javafx.scene.control.Button
import javafx.event.EventHandler
import javafx.event.ActionEvent

class KillDialog: Dialog {
  override val type: String
  override val title: String
  override val msg: String
  override val neutralButton: Button?
  override val yesButton: Button?
  override val noButton: Button?

  constructor() {
    type = "warning"
    title = "Server is still running!"
    msg = "You should only kill the server if absolutely necessary, i.e. not being responsive after long periods of time. Data loss may occur. Continue anyway?"
    hold = false

    noButton = Button("No")
    noButton.onAction = EventHandler<ActionEvent>() {
      result = false
      dialog.hide()
    }
    yesButton = Button("Yes")
    yesButton.onAction = EventHandler<ActionEvent>() {
      result = true
      dialog.hide()
    }
    yesButton.isDefaultButton = true
    neutralButton = null
  }
}