Class KDialog

All Implemented Interfaces:
ImageObserver, MenuContainer, Serializable, Accessible, RootPaneContainer, WindowConstants
Direct Known Subclasses:
AbstractShowRecruits, AcquireAngel, AutoInspector, BattleTerrainHazardWindow, ChooseScreen, Concede, CreatureCollectionView, EditLegion, EngagementResults, EventViewer, Negotiate, PickCarry, PickColor, PickIntValue, PickLord, PickMarker, PickRecruit, PickRecruiter, PickStrikePenalty, PlayerDetailsDialog, ReplyToProposal, ShowCreatureDetails, ShowLegion, SplitLegion, StatusScreen, SummonAngel.SummonAngelDialog

public class KDialog extends JDialog
KDialog adds some generally useful functions to JDialog.
Author:
David Ripton
See Also:
  • Field Details

  • Constructor Details

    • KDialog

      public KDialog(Frame owner, String title, boolean modal)
      Only support one of JDialog's many constructor forms.
  • Method Details

    • assertEDT

      protected void assertEDT() throws AssertionError
      Asserts that the current thread is the Event Dispatch Thread.
      Throws:
      AssertionError - if assertions are enabled and the current thread is not the EDT
    • placeRelative

      public void placeRelative(JFrame parentFrame, Point point, JScrollPane pane)
      Place dialog relative to parentFrame's origin, offset by point, and fully on-screen.
    • centerOnScreen

      public void centerOnScreen()
      Center this dialog on the screen. Must be called after the dialog size has been set.
    • centerOnScreen

      public void centerOnScreen(int xoffset, int yoffset)
      Center this dialog on the screen, with an additional offset. Must be called after the dialog size has been set.
    • getUpperRightCorner

      public Point getUpperRightCorner(int width)
      Returns a point with a horizontal offset of the top right corner of the screen. This finds the upper right corner of the computer's screen and then moves the location to the left by the given width.
      Parameters:
      width - The horizontal offset.
      Returns:
      the target location
    • lowerRightCorner

      public void lowerRightCorner()
    • useSaveWindow

      public void useSaveWindow(IOptions options, String windowName, Point defaultLocation)
      If, and only if, the extending class calls this useSaveWindow, then the KDialog will handle the SaveWindow work: creating it when useSaveWindow is called, and saving back always when setVisible(false) is called (and useSaveWindow was called before, of course). TODO maybe we should enforce this by calling it through the constructor
      Parameters:
      options - IOptions reference to the client for saving window size+pos in the Options data
      windowName - name/title of the window, window size+pos are stored for that name
      defaultLocation - to be used if no location was earlier stored: place there; give null to center on screen.
    • setVisible

      public void setVisible(boolean val)
      Overrides:
      setVisible in class Dialog
    • dispose

      public void dispose()
      Overrides:
      dispose in class Window