Class TopcatWindowAction<W extends JFrame>

All Implemented Interfaces:
ActionListener, Serializable, Cloneable, EventListener, Action, TopcatToolAction

public class TopcatWindowAction<W extends JFrame> extends BasicAction implements TopcatToolAction
TopcatToolAction implementation that instantiates a window of a given class when invoked. The window will be instantiated via a constructor taking a single Component argument; such a constructor must therefore exist. This parent component is just used to position the window, it's permissible, though not encouraged, to just ignore that argument.
Since:
24 Jul 2013
Author:
Mark Taylor
See Also:
  • Constructor Details

    • TopcatWindowAction

      public TopcatWindowAction(String name, Icon icon, String shortdesc, Class<? extends W> winClazz)
      Constructor.
      Parameters:
      name - action name
      icon - action icon
      shortdesc - action short description
      winClazz - class of window to instantiate; must have a constructor that takes a java.awt.Component giving the window parent
  • Method Details

    • createWindow

      protected W createWindow()
      Creates an instance of the window class used by this action.
      Returns:
      window initialised with parent component
    • actionPerformed

      public void actionPerformed(ActionEvent evt)
      Performs the action. The default immplementation just calls createWindow() and sets it visible. This may be overridden.
      Specified by:
      actionPerformed in interface ActionListener
    • setParent

      public void setParent(Component parent)
      Sets the parent component to use for initialising windows created by this action.
      Specified by:
      setParent in interface TopcatToolAction
      Parameters:
      parent - parent component