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 Rectanglem_CurrentBoundsthe current size/location.protected booleanm_Enabledwhether enabled or not.protected booleanm_IgnoreStateChangeEventwhether to ignored the state change event.protected booleanm_Loggingwhether to output some logging information.protected Framem_Ownerthe owning window.protected Rectanglem_UnMaximizedBoundsthe unmaximized size/location.protected intm_Waitthe 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 booleangetIgnoreStateChangeEvent()Returns whether change events are currently ignored.FramegetOwner()Returns the owner.intgetWait()Returns the wait period in msec.booleanisEnabled()Returns whether the listener is enabled.booleanisLoggingEnabled()Returns whether logging is enabled.protected voidlog(String msg)Logs the message to stdout.voidupdateBounds(int x, int y, int width, int height)Updates the current bounds.voidupdateBounds(Rectangle bounds)Updates the current bounds.voidwindowStateChanged(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:
windowStateChangedin interfaceWindowStateListener- Overrides:
windowStateChangedin classWindowAdapter
-
-