Package slash.navigation.gui.helpers
Class WindowHelper
java.lang.Object
slash.navigation.gui.helpers.WindowHelper
A helper for
JFrame and JDialog operations, and the single
choke point for JOptionPane message/confirm/input dialogs. Every
wrapper defaults the parent to the main frame and the
title to the owner window's title, and bounds long plain-text messages
(e.g. stacktraces) in a scroll pane so a dialog can never grow past the
screen.- Author:
- Christian Pesch
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic JFramegetFrame()static voidstatic voidhandleThrowable(Class<?> clazz, ActionEvent e, Throwable throwable) static intshowConfirm(Window owner, Object message, String title, int optionType) static intshowConfirm(Object message, String title, int optionType) static voidstatic voidNull-safe:ownermay be null (e.g. before the frame exists).static voidstatic voidshowInformation(Window owner, Object message) static voidshowInformation(Window owner, Object message, String title) static voidshowInformation(Object message) static booleanshowInformationWithAction(Window owner, Object message, String title, String actionText) An informational dialog whose call to action sits in the button row, left of OK, instead of floating inside the message.static Stringstatic StringFree-text input pre-filled withinitialValue.static Stringstatic voidshowWarning(Window owner, Object message) static voidshowWarning(Object message)
-
Field Details
-
log
-
-
Constructor Details
-
WindowHelper
public WindowHelper()
-
-
Method Details
-
getFrame
-
showError
-
showError
-
showError
Null-safe:ownermay be null (e.g. before the frame exists). -
showWarning
-
showWarning
-
showInformation
-
showInformation
-
showInformation
-
showInformationWithAction
public static boolean showInformationWithAction(Window owner, Object message, String title, String actionText) An informational dialog whose call to action sits in the button row, left of OK, instead of floating inside the message. Returns true if the action was chosen. -
showConfirm
-
showConfirm
-
showInput
-
showInput
-
showInput
Free-text input pre-filled withinitialValue. -
handleOutOfMemoryError
-
handleThrowable
-