prog.utils
Class InOutList

java.lang.Object
  |
  +--java.awt.Component
        |
        +--java.awt.Container
              |
              +--javax.swing.JComponent
                    |
                    +--javax.swing.JPanel
                          |
                          +--prog.utils.InOutList
All Implemented Interfaces:
javax.accessibility.Accessible, java.util.EventListener, java.awt.image.ImageObserver, java.awt.MenuContainer, java.awt.event.MouseListener, java.io.Serializable

public class InOutList
extends javax.swing.JPanel
implements java.awt.event.MouseListener

An InOutList is a combination of two lists. Double-clicking an item in one column sends it to the other. The default headings for the columns are In and Not In.

Author:
John Darrow (c) 2001
See Also:
Serialized Form

Inner classes inherited from class javax.swing.JPanel
javax.swing.JPanel.AccessibleJPanel
 
Inner classes inherited from class javax.swing.JComponent
javax.swing.JComponent.AccessibleJComponent
 
Inner classes inherited from class java.awt.Container
java.awt.Container.AccessibleAWTContainer
 
Inner classes inherited from class java.awt.Component
java.awt.Component.AccessibleAWTComponent
 
Fields inherited from class javax.swing.JComponent
accessibleContext, listenerList, TOOL_TIP_TEXT_KEY, ui, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOW
 
Fields inherited from class java.awt.Component
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
 
Fields inherited from interface java.awt.image.ImageObserver
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
 
Constructor Summary
InOutList()
           
 
Method Summary
 void addListSelectionListener(java.lang.Object ob)
          Registers an object as a listener for a selection of an item in either column.
 void addMoveListener(java.lang.Object ob)
          Registers an object as a listener for a move of an item from one column to another.
 void clearSelection()
          Clears both columns.
 java.util.Vector getListIn()
          Returns the elements of the lefthand list.
 java.lang.Object getMovedObject()
          Returns the object that was moved from one column to the other.
 java.lang.Object getSelectedValue()
          Returns the item that was selected (whether moved or not).
static void main(java.lang.String[] args)
           
 void mouseClicked(java.awt.event.MouseEvent e)
          Responds to single and double clicks in either column.
 void mouseEntered(java.awt.event.MouseEvent e)
           
 void mouseExited(java.awt.event.MouseEvent e)
           
 void mousePressed(java.awt.event.MouseEvent e)
           
 void mouseReleased(java.awt.event.MouseEvent e)
           
 void refresh()
          Redisplays the lists.
 void removeListSelectionListener(java.lang.Object ob)
          Deregisters an object as a listener for a selection of an item in either column.
 void removeMoveListener(java.lang.Object ob)
          Deregisters an object as a listener for a move of an item from one column to another.
 void setHeadings(java.lang.String inHead, java.lang.String outHead)
          Sets the headings of the columns.
 void setInTotal(java.util.Vector inList, java.util.Vector totalList)
          Sets the lefthand list to contain the elements of inList and sets the righthand list to contain the elements resulting from totalList minus inList.
 void setListIn(java.util.Vector newList)
          Sets the lefthand list to contain the elements of newList.
 void setListOut(java.util.Vector newList)
          Sets the righthand list to contain the elements of newList.
 void setPreferredSize(java.awt.Dimension newSize)
          Sets the desired dimensions of the InOutList.
 
Methods inherited from class javax.swing.JPanel
getAccessibleContext, getUIClassID, paramString, updateUI
 
Methods inherited from class javax.swing.JComponent
addAncestorListener, addNotify, addPropertyChangeListener, addPropertyChangeListener, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, fireVetoableChange, getActionForKeyStroke, getActionMap, getAlignmentX, getAlignmentY, getAutoscrolls, getBorder, getBounds, getClientProperty, getComponentGraphics, getConditionForKeyStroke, getDebugGraphicsOptions, getGraphics, getHeight, getInputMap, getInputMap, getInputVerifier, getInsets, getInsets, getListeners, getLocation, getMaximumSize, getMinimumSize, getNextFocusableComponent, getPreferredSize, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getToolTipText, getTopLevelAncestor, getVerifyInputWhenFocusTarget, getVisibleRect, getWidth, getX, getY, grabFocus, hasFocus, hide, isDoubleBuffered, isFocusCycleRoot, isFocusTraversable, isLightweightComponent, isManagingFocus, isMaximumSizeSet, isMinimumSizeSet, isOpaque, isOptimizedDrawingEnabled, isPaintingTile, isPreferredSizeSet, isRequestFocusEnabled, isValidateRoot, paint, paintBorder, paintChildren, paintComponent, paintImmediately, paintImmediately, print, printAll, printBorder, printChildren, printComponent, processComponentKeyEvent, processFocusEvent, processKeyBinding, processKeyEvent, processMouseMotionEvent, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeNotify, removePropertyChangeListener, removePropertyChangeListener, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, requestFocus, resetKeyboardActions, reshape, revalidate, scrollRectToVisible, setActionMap, setAlignmentX, setAlignmentY, setAutoscrolls, setBackground, setBorder, setDebugGraphicsOptions, setDoubleBuffered, setEnabled, setFont, setForeground, setInputMap, setInputVerifier, setMaximumSize, setMinimumSize, setNextFocusableComponent, setOpaque, setRequestFocusEnabled, setToolTipText, setUI, setVerifyInputWhenFocusTarget, setVisible, unregisterKeyboardAction, update
 
Methods inherited from class java.awt.Container
add, add, add, add, add, addContainerListener, addImpl, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getLayout, insets, invalidate, isAncestorOf, layout, list, list, locate, minimumSize, paintComponents, preferredSize, printComponents, processContainerEvent, processEvent, remove, remove, removeAll, removeContainerListener, setLayout, validate, validateTree
 
Methods inherited from class java.awt.Component
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, bounds, checkImage, checkImage, coalesceEvents, contains, createImage, createImage, disableEvents, dispatchEvent, enable, enableEvents, enableInputMethods, getBackground, getBounds, getColorModel, getComponentOrientation, getCursor, getDropTarget, getFont, getFontMetrics, getForeground, getGraphicsConfiguration, getInputContext, getInputMethodRequests, getLocale, getLocation, getLocationOnScreen, getName, getParent, getPeer, getSize, getToolkit, getTreeLock, gotFocus, handleEvent, imageUpdate, inside, isDisplayable, isEnabled, isLightweight, isShowing, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, postEvent, prepareImage, prepareImage, processComponentEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processMouseEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, repaint, repaint, repaint, resize, resize, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setLocale, setLocation, setLocation, setName, setSize, setSize, show, show, size, toString, transferFocus
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

InOutList

public InOutList()
Method Detail

setHeadings

public void setHeadings(java.lang.String inHead,
                        java.lang.String outHead)
Sets the headings of the columns. By default, the headings are In and Not In.

setListIn

public void setListIn(java.util.Vector newList)
Sets the lefthand list to contain the elements of newList.

setListOut

public void setListOut(java.util.Vector newList)
Sets the righthand list to contain the elements of newList.

setInTotal

public void setInTotal(java.util.Vector inList,
                       java.util.Vector totalList)
Sets the lefthand list to contain the elements of inList and sets the righthand list to contain the elements resulting from totalList minus inList.

getListIn

public java.util.Vector getListIn()
Returns the elements of the lefthand list.

addMoveListener

public void addMoveListener(java.lang.Object ob)
Registers an object as a listener for a move of an item from one column to another.

removeMoveListener

public void removeMoveListener(java.lang.Object ob)
Deregisters an object as a listener for a move of an item from one column to another.

addListSelectionListener

public void addListSelectionListener(java.lang.Object ob)
Registers an object as a listener for a selection of an item in either column.

removeListSelectionListener

public void removeListSelectionListener(java.lang.Object ob)
Deregisters an object as a listener for a selection of an item in either column.

setPreferredSize

public void setPreferredSize(java.awt.Dimension newSize)
Sets the desired dimensions of the InOutList.
Overrides:
setPreferredSize in class javax.swing.JComponent

getMovedObject

public java.lang.Object getMovedObject()
Returns the object that was moved from one column to the other.

getSelectedValue

public java.lang.Object getSelectedValue()
Returns the item that was selected (whether moved or not).

refresh

public void refresh()
Redisplays the lists.

clearSelection

public void clearSelection()
Clears both columns.

mouseClicked

public void mouseClicked(java.awt.event.MouseEvent e)
Responds to single and double clicks in either column.
Specified by:
mouseClicked in interface java.awt.event.MouseListener

mousePressed

public void mousePressed(java.awt.event.MouseEvent e)
Specified by:
mousePressed in interface java.awt.event.MouseListener

mouseReleased

public void mouseReleased(java.awt.event.MouseEvent e)
Specified by:
mouseReleased in interface java.awt.event.MouseListener

mouseEntered

public void mouseEntered(java.awt.event.MouseEvent e)
Specified by:
mouseEntered in interface java.awt.event.MouseListener

mouseExited

public void mouseExited(java.awt.event.MouseEvent e)
Specified by:
mouseExited in interface java.awt.event.MouseListener

main

public static void main(java.lang.String[] args)