Skip to content

Commit

Permalink
Add UIAppCriticalErrorMessage
Browse files Browse the repository at this point in the history
  • Loading branch information
CattenLinger committed Nov 7, 2022
1 parent e21df86 commit f9278ef
Show file tree
Hide file tree
Showing 5 changed files with 32 additions and 2 deletions.
9 changes: 7 additions & 2 deletions buildSrc/.gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,7 @@
/.gradle
/build
/.idea
/target
/build

*.iml

.DS_Store
1 change: 1 addition & 0 deletions settings.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,6 @@
rootProject.name = "toy-brick"

include(
":toy-brick-common",
":toy-brick-fx", ":toy-brick-fx-demo"
)
7 changes: 7 additions & 0 deletions toy-brick-common/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
/.idea
/target
/build

*.iml

.DS_Store
Empty file.
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
package com.shinonometn.toybrick.common

import java.awt.Image
import javax.swing.ImageIcon
import javax.swing.JOptionPane
import kotlin.system.exitProcess

data class UIAppCriticalErrorMessage(val title: String, val message: String, val exception: Exception?)

fun UIAppCriticalErrorMessage.promptSwingDialog(icon: Image? = null, exitStatus: Int = 1) {
if (icon != null) JOptionPane.showMessageDialog(
null, message, title, JOptionPane.ERROR_MESSAGE, ImageIcon(icon)
) else JOptionPane.showMessageDialog(
null, message, title, JOptionPane.ERROR_MESSAGE
)
exitProcess(exitStatus)
}

0 comments on commit f9278ef

Please sign in to comment.