Skip to content

Commit 8125f42

Browse files
committed
ShowMessage - allow for resizing all message dialogs #32
1 parent 3eefe11 commit 8125f42

File tree

1 file changed

+12
-4
lines changed

1 file changed

+12
-4
lines changed

scalafx-extras/src/main/scala/org/scalafx/extras/ShowMessage.scala

+12-4
Original file line numberDiff line numberDiff line change
@@ -86,11 +86,18 @@ object ShowMessage {
8686
* @param t exception.
8787
* @param parentWindow owner window that will be blacked by the dialog.
8888
*/
89-
def exception(title: String, message: String, t: Throwable, parentWindow: Option[Window] = None): Unit = {
89+
def exception(
90+
title: String,
91+
message: String,
92+
t: Throwable,
93+
parentWindow: Option[Window] = None,
94+
resizable: Boolean = false
95+
): Unit = {
9096
t.printStackTrace()
9197

9298
// Rename to avoid name clashes
93-
val dialogTitle = title
99+
val _title = title
100+
val _resizable = resizable
94101

95102
// Create expandable Exception.
96103
val exceptionText = {
@@ -118,11 +125,12 @@ object ShowMessage {
118125
onFXAndWait {
119126
new Alert(AlertType.Error) {
120127
initOwner(parentWindow.orNull)
121-
this.title = dialogTitle
128+
this.title = _title
122129
headerText = message
123130
contentText = Option(t.getMessage).getOrElse("")
124131
// Set expandable Exception into the dialog pane.
125132
dialogPane().expandableContent = expContent
133+
this.resizable = _resizable
126134
}.showAndWait()
127135
}
128136
}
@@ -237,7 +245,7 @@ trait ShowMessage {
237245
* @param message Message (excluding t.getMessage(), it is automatically displayed)
238246
* @param t exception to be displayed in the dialog
239247
*/
240-
def showException(title: String, message: String, t: Throwable): Unit = {
248+
def showException(title: String, message: String, t: Throwable, resizable: Boolean = false): Unit = {
241249
messageLogger.foreach(_.error(s"<$title> $message", t))
242250
ShowMessage.exception(title, message, t, parentWindow)
243251
}

0 commit comments

Comments
 (0)