net.sourceforge.nite.tools.videolabeler
Class SelfSelectingFrames

java.lang.Object
  extended by net.sourceforge.nite.tools.videolabeler.SelfSelectingFrames

public class SelfSelectingFrames
extends java.lang.Object

With this class you can make an internal frame self-selecting or make all frames in a desktop pane self-selecting. That means that an internal frame will be selected when the mouse is moved over the frame or any of its contents. This will also work for any components that are added to the frame later and for any frames that are added to the desktop later.

The functionality for an internal frame is implemented with two listeners. A mouse listener for the frame and all its components, and a container listener for all containers in the frame. When the user moves the mouse over the frame or a component in the frame, the mouse listener will be activated, which will select the frame. If a component is added to a container in the frame, the mouse listener and container listener (if possible) will be added to the new component. When a component is removed from a container, the mouse listener and container listener will be removed from that component.

The functionality for a desktop pane is implemented with a container listener. When a frame is added to the desktop, it will be made self-selecting as described above. When a frame is removed from the desktop, the self-selecting functionality will be removed from the frame.


Constructor Summary
SelfSelectingFrames()
           
 
Method Summary
static void setFramesSelfSelecting(javax.swing.JDesktopPane desktop, boolean set)
          Makes all internal frames on the specified desktop self-selecting or removes the self-selecting function from all frames.
static void setSelfSelecting(javax.swing.JInternalFrame frame, boolean set)
          Makes an internal frame self-selecting or removes the self-selecting function.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SelfSelectingFrames

public SelfSelectingFrames()
Method Detail

setFramesSelfSelecting

public static void setFramesSelfSelecting(javax.swing.JDesktopPane desktop,
                                          boolean set)

Makes all internal frames on the specified desktop self-selecting or removes the self-selecting function from all frames.

Parameters:
desktop - the desktop
set - true if the frames should become self-selecting, false if they should not be self-selecting anymore

setSelfSelecting

public static void setSelfSelecting(javax.swing.JInternalFrame frame,
                                    boolean set)

Makes an internal frame self-selecting or removes the self-selecting function.

Parameters:
frame - the frame
set - true if the frame should become self-selecting, false if it should not be self-selecting anymore