Class MaximizationFixWindowListener

  • All Implemented Interfaces:
    WindowFocusListener, WindowListener, WindowStateListener, EventListener

    public class MaximizationFixWindowListener
    extends WindowAdapter
    Provides a work-around for platforms where the maximization of frames (eg JFrame) results in strange behaviors. Linux is such a platform, with popup menus (and the selectio) getting their coordinates completely wrong.
    Version:
    $Revision$
    Author:
    FracPete (fracpete at waikato dot ac dot nz)
    • Field Detail

      • m_Owner

        protected Frame m_Owner
        the owning window.
      • m_Enabled

        protected boolean m_Enabled
        whether enabled or not.
      • m_Wait

        protected int m_Wait
        the wait period in msec.
      • m_Logging

        protected boolean m_Logging
        whether to output some logging information.
      • m_CurrentBounds

        protected Rectangle m_CurrentBounds
        the current size/location.
      • m_UnMaximizedBounds

        protected Rectangle m_UnMaximizedBounds
        the unmaximized size/location.
      • m_IgnoreStateChangeEvent

        protected boolean m_IgnoreStateChangeEvent
        whether to ignored the state change event.
    • Constructor Detail

      • MaximizationFixWindowListener

        public MaximizationFixWindowListener​(Frame owner,
                                             boolean enabled,
                                             int wait)
        Initializes the listener.
        Parameters:
        owner - the owning frame
        enabled - whether enabled
        wait - the wait period in msec
      • MaximizationFixWindowListener

        public MaximizationFixWindowListener​(Frame owner,
                                             boolean enabled,
                                             int wait,
                                             boolean logging)
        Initializes the listener.
        Parameters:
        owner - the owning frame
        enabled - whether enabled
        wait - the wait period in msec
        logging - whether to output logging information
    • Method Detail

      • getOwner

        public Frame getOwner()
        Returns the owner.
        Returns:
        the owning frame
      • isEnabled

        public boolean isEnabled()
        Returns whether the listener is enabled.
        Returns:
        true if enabled
      • getWait

        public int getWait()
        Returns the wait period in msec.
        Returns:
        the period in msec
      • isLoggingEnabled

        public boolean isLoggingEnabled()
        Returns whether logging is enabled.
        Returns:
        true if enabled
      • getIgnoreStateChangeEvent

        public boolean getIgnoreStateChangeEvent()
        Returns whether change events are currently ignored.
        Returns:
        true if ignored
      • log

        protected void log​(String msg)
        Logs the message to stdout.
        Parameters:
        msg - the message to log
      • updateBounds

        public void updateBounds​(int x,
                                 int y,
                                 int width,
                                 int height)
        Updates the current bounds.
        Parameters:
        x - the x of the owner
        y - the y of the owner
        width - the width of the owner
        height - the height of the owner
      • updateBounds

        public void updateBounds​(Rectangle bounds)
        Updates the current bounds.
        Parameters:
        bounds - the current bounds of the owner