Package adams.gui.core
Class MaximizationFixWindowListener
- java.lang.Object
-
- java.awt.event.WindowAdapter
-
- adams.gui.core.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 Summary
Fields Modifier and Type Field Description protected Rectangle
m_CurrentBounds
the current size/location.protected boolean
m_Enabled
whether enabled or not.protected boolean
m_IgnoreStateChangeEvent
whether to ignored the state change event.protected boolean
m_Logging
whether to output some logging information.protected Frame
m_Owner
the owning window.protected Rectangle
m_UnMaximizedBounds
the unmaximized size/location.protected int
m_Wait
the wait period in msec.
-
Constructor Summary
Constructors Constructor Description MaximizationFixWindowListener(Frame owner, boolean enabled, int wait)
Initializes the listener.MaximizationFixWindowListener(Frame owner, boolean enabled, int wait, boolean logging)
Initializes the listener.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
getIgnoreStateChangeEvent()
Returns whether change events are currently ignored.Frame
getOwner()
Returns the owner.int
getWait()
Returns the wait period in msec.boolean
isEnabled()
Returns whether the listener is enabled.boolean
isLoggingEnabled()
Returns whether logging is enabled.protected void
log(String msg)
Logs the message to stdout.void
updateBounds(int x, int y, int width, int height)
Updates the current bounds.void
updateBounds(Rectangle bounds)
Updates the current bounds.void
windowStateChanged(WindowEvent e)
-
Methods inherited from class java.awt.event.WindowAdapter
windowActivated, windowClosed, windowClosing, windowDeactivated, windowDeiconified, windowGainedFocus, windowIconified, windowLostFocus, windowOpened
-
-
-
-
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 frameenabled
- whether enabledwait
- the wait period in msec
-
MaximizationFixWindowListener
public MaximizationFixWindowListener(Frame owner, boolean enabled, int wait, boolean logging)
Initializes the listener.- Parameters:
owner
- the owning frameenabled
- whether enabledwait
- the wait period in mseclogging
- 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 ownery
- the y of the ownerwidth
- the width of the ownerheight
- the height of the owner
-
updateBounds
public void updateBounds(Rectangle bounds)
Updates the current bounds.- Parameters:
bounds
- the current bounds of the owner
-
windowStateChanged
public void windowStateChanged(WindowEvent e)
- Specified by:
windowStateChanged
in interfaceWindowStateListener
- Overrides:
windowStateChanged
in classWindowAdapter
-
-