Class WindowHelper

java.lang.Object
slash.navigation.gui.helpers.WindowHelper

public class WindowHelper extends Object
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 Details

    • log

      public static final Logger log
  • Constructor Details

    • WindowHelper

      public WindowHelper()
  • Method Details

    • getFrame

      public static JFrame getFrame()
    • showError

      public static void showError(Object message)
    • showError

      public static void showError(Window owner, Object message)
    • showError

      public static void showError(Window owner, Object message, String title)
      Null-safe: owner may be null (e.g. before the frame exists).
    • showWarning

      public static void showWarning(Object message)
    • showWarning

      public static void showWarning(Window owner, Object message)
    • showInformation

      public static void showInformation(Object message)
    • showInformation

      public static void showInformation(Window owner, Object message)
    • showInformation

      public static void showInformation(Window owner, Object message, String title)
    • 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

      public static int showConfirm(Object message, String title, int optionType)
    • showConfirm

      public static int showConfirm(Window owner, Object message, String title, int optionType)
    • showInput

      public static String showInput(Object message, String title)
    • showInput

      public static String showInput(Window owner, Object message, String title)
    • showInput

      public static String showInput(Window owner, Object message, String title, Object initialValue)
      Free-text input pre-filled with initialValue.
    • handleOutOfMemoryError

      public static void handleOutOfMemoryError(OutOfMemoryError e)
    • handleThrowable

      public static void handleThrowable(Class<?> clazz, ActionEvent e, Throwable throwable)