Class WindowMonitor

java.lang.Object
org.fest.swing.monitor.WindowMonitor

public class WindowMonitor extends Object
Understands a monitor that keeps track of all known root windows (showing, hidden, closed.)
  • Field Details

  • Constructor Details

    • WindowMonitor

      @RunsInCurrentThread WindowMonitor(Toolkit toolkit)
      Create an instance of WindowTracker which will track all windows coming and going on the current and subsequent AppContexts.

      WARNING: if an applet loads this class, it will only ever see stuff in its own AppContext.

      Parameters:
      toolkit - the Toolkit to use.
    • WindowMonitor

      @RunsInCurrentThread WindowMonitor(Toolkit toolkit, Context context, WindowStatus windowStatus)
  • Method Details

    • populateExistingWindows

      private void populateExistingWindows()
    • examine

      @RunsInCurrentThread private void examine(Window w)
    • isWindowReady

      public boolean isWindowReady(Window w)
      Returns whether the window is ready to receive OS-level event input. A window's "isShowing" flag may be set true before the WINDOW_OPENED event is generated, and even after the WINDOW_OPENED is sent the window peer is not guaranteed to be ready.
      Parameters:
      w - the given window.
      Returns:
      whether the window is ready to receive OS-level event input.
    • eventQueueFor

      public EventQueue eventQueueFor(Component c)
      Returns the event queue corresponding to the given component. In most cases, this is the same as Component.getToolkit().getSystemEventQueue(), but in the case of applets will bypass the AppContext and provide the real event queue.
      Parameters:
      c - the given component.
      Returns:
      the event queue corresponding to the given component.
    • allEventQueues

      public Collection<EventQueue> allEventQueues()
      Returns all known event queues.
      Returns:
      all known event queues.
    • rootWindows

      public Collection<Window> rootWindows()
      Return all available root windows. A root window is one that has a null parent. Nominally this means a list similar to that returned by Frame.getFrames(), but in the case of an Applet may return a few dialogs as well.
      Returns:
      all available root windows.
    • instance

      @RunsInEDT public static WindowMonitor instance()
      Returns the singleton instance of this class.
      Returns:
      the singleton instance of this class.