com.alee.utils.swing
Class WindowFollowAdapter

java.lang.Object
  extended by java.awt.event.ComponentAdapter
      extended by com.alee.utils.swing.WindowFollowAdapter
All Implemented Interfaces:
java.awt.event.ComponentListener, java.util.EventListener

public class WindowFollowAdapter
extends java.awt.event.ComponentAdapter

This listener allows you to quickly attach one window to another window. This means that this window will always follow the other one when it moves on the screen. Though the other window in this link will not follow this window as it moves.

Author:
Mikle Garin

Field Summary
protected  boolean enabled
           
protected  java.awt.Window followingWindow
           
protected  java.awt.Point lastLocation
           
protected  java.awt.Window parentWindow
           
 
Constructor Summary
WindowFollowAdapter(java.awt.Window followingWindow, java.awt.Window parentWindow)
           
 
Method Summary
 void componentMoved(java.awt.event.ComponentEvent e)
           
 void componentResized(java.awt.event.ComponentEvent e)
           
 java.awt.Window getFollowingWindow()
           
 java.awt.Window getParentWindow()
           
static WindowFollowAdapter install(java.awt.Window followingWindow, java.awt.Window parentWindow)
           
 boolean isEnabled()
           
 void setEnabled(boolean enabled)
           
static void uninstall(java.awt.Window parentWindow, WindowFollowAdapter windowFollowAdapter)
           
 void updateLastLocation()
           
 
Methods inherited from class java.awt.event.ComponentAdapter
componentHidden, componentShown
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

followingWindow

protected final java.awt.Window followingWindow

parentWindow

protected final java.awt.Window parentWindow

enabled

protected boolean enabled

lastLocation

protected java.awt.Point lastLocation
Constructor Detail

WindowFollowAdapter

public WindowFollowAdapter(java.awt.Window followingWindow,
                           java.awt.Window parentWindow)
Method Detail

isEnabled

public boolean isEnabled()

setEnabled

public void setEnabled(boolean enabled)

updateLastLocation

public void updateLastLocation()

getFollowingWindow

public java.awt.Window getFollowingWindow()

getParentWindow

public java.awt.Window getParentWindow()

componentResized

public void componentResized(java.awt.event.ComponentEvent e)
Specified by:
componentResized in interface java.awt.event.ComponentListener
Overrides:
componentResized in class java.awt.event.ComponentAdapter

componentMoved

public void componentMoved(java.awt.event.ComponentEvent e)
Specified by:
componentMoved in interface java.awt.event.ComponentListener
Overrides:
componentMoved in class java.awt.event.ComponentAdapter

install

public static WindowFollowAdapter install(java.awt.Window followingWindow,
                                          java.awt.Window parentWindow)

uninstall

public static void uninstall(java.awt.Window parentWindow,
                             WindowFollowAdapter windowFollowAdapter)