Class WindowUtils

java.lang.Object
games.stendhal.client.gui.WindowUtils

public class WindowUtils extends Object
Utilities for system level windows.
  • Method Details

    • closeOnEscape

      public static void closeOnEscape(JDialog dialog)
      Make the dialog close when the used presses escape. The event will be the same as when the user closes the window using the window manager.
      Parameters:
      dialog - dialog to make obey the escape key
    • trackLocation

      public static void trackLocation(Window window, String windowId, boolean followSize)
      Track the windows location so that it can be restored at next client start.
      Parameters:
      window - tracked window
      windowId - identifier for the window. This should be unique for each window type. The restored location is looked up by the identifier.
      followSize - track the size of the window too
    • restoreSize

      public static void restoreSize(Window window)
      Restore the size of a tracked window.
      Parameters:
      window - window whose size should be restored
      Throws:
      IllegalArgumentException - in case restoring a window that is not tracked is tried
    • watchFontSize

      public static void watchFontSize(Component component)
      Register a component that should watch for default font size changes. Typically the component should be the top level window.
      Parameters:
      component - root component for the tree whose font size shall be changed at default font size changes