JComponentPack 1.5.0

com.zfqjava.swing
Class XList

java.lang.Object
  extended by java.awt.Component
      extended by java.awt.Container
          extended by javax.swing.JComponent
              extended by javax.swing.JList
                  extended by com.zfqjava.swing.XList
All Implemented Interfaces:
ImageObserver, MenuContainer, Serializable, Accessible, Scrollable

public class XList
extends JList

XList provides a editable JList.

See Also:
Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from class javax.swing.JList
JList.AccessibleJList, JList.DropLocation
 
Nested classes/interfaces inherited from class javax.swing.JComponent
JComponent.AccessibleJComponent
 
Nested classes/interfaces inherited from class java.awt.Container
Container.AccessibleAWTContainer
 
Nested classes/interfaces inherited from class java.awt.Component
Component.AccessibleAWTComponent, Component.BaselineResizeBehavior, Component.BltBufferStrategy, Component.FlipBufferStrategy
 
Field Summary
static int LARGE_ICON_VIEW_MODE
          Identifies the large icon view mode.
static int LIST_VIEW_MODE
          Identifies the list view mode.
static int SMALL_ICON_VIEW_MODE
          Identifies the small icon view mode.
static int THUMBNAILS_VIEW_MODE
          Identifies the thumbnails view mode.
 
Fields inherited from class javax.swing.JList
HORIZONTAL_WRAP, VERTICAL, VERTICAL_WRAP
 
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
XList()
           
XList(ListModel model)
           
XList(Object[] a)
           
 
Method Summary
 void addActionListener(ActionListener listener)
          Adds an action listener to the XList.
 void cancelEditing()
          Cancels the current editing.
protected  void fireActionPerformed(ActionEvent e)
          Notifies all listeners that have registered interest for notification on this event type.
 int getActionClickCount()
           
 ActionListener[] getActionListeners()
          Returns an array of all the action listeners registered on this XList.
 AbstractCellEditor getCellEditor()
          Retruns the cell editor.
 Dimension getCellPreferredSize(int viewMode)
          Returns the cell preferred size for the specified view mode.
 int getEditingIndex()
          Return the index of current editing.
 Component getEditorComponent()
           
 int getViewMode()
          Gets the XList display mode in use.
 boolean isEditing()
          Returns true if the XList is being edited.
 boolean isIndexEditable(int index)
          Returns true if the speified index is editable.
 boolean isIndexEditable(int index, EventObject e)
           
 void removeActionListener(ActionListener listener)
          Removes the specified action listener from the XList.
 void setActionClickCount(int actionClickCount)
           
 void setCellEditor(AbstractCellEditor cellEditor)
          Sets the editor.
 void setCellPreferredSize(int viewMode, Dimension size)
          Sets the preferred cell size for the specified view mode.
 void setElementAt(Object o, int index)
          Sets the element at the specified index.
 void setViewMode(int mode)
          Sets the XList display mode.
 void startEditingAtIndex(int index)
           
 void startEditingAtIndex(int index, EventObject e)
           
 boolean stopEditing()
          Stops the current editing.
 void updateUI()
           
 
Methods inherited from class javax.swing.JList
addListSelectionListener, addSelectionInterval, clearSelection, createSelectionModel, ensureIndexIsVisible, fireSelectionValueChanged, getAccessibleContext, getAnchorSelectionIndex, getCellBounds, getCellRenderer, getDragEnabled, getDropLocation, getDropMode, getFirstVisibleIndex, getFixedCellHeight, getFixedCellWidth, getLastVisibleIndex, getLayoutOrientation, getLeadSelectionIndex, getListSelectionListeners, getMaxSelectionIndex, getMinSelectionIndex, getModel, getNextMatch, getPreferredScrollableViewportSize, getPrototypeCellValue, getScrollableBlockIncrement, getScrollableTracksViewportHeight, getScrollableTracksViewportWidth, getScrollableUnitIncrement, getSelectedIndex, getSelectedIndices, getSelectedValue, getSelectedValues, getSelectionBackground, getSelectionForeground, getSelectionMode, getSelectionModel, getToolTipText, getUI, getUIClassID, getValueIsAdjusting, getVisibleRowCount, indexToLocation, isSelectedIndex, isSelectionEmpty, locationToIndex, paramString, removeListSelectionListener, removeSelectionInterval, setCellRenderer, setDragEnabled, setDropMode, setFixedCellHeight, setFixedCellWidth, setLayoutOrientation, setListData, setListData, setModel, setPrototypeCellValue, setSelectedIndex, setSelectedIndices, setSelectedValue, setSelectionBackground, setSelectionForeground, setSelectionInterval, setSelectionMode, setSelectionModel, setUI, setValueIsAdjusting, setVisibleRowCount
 
Methods inherited from class javax.swing.JComponent
addAncestorListener, addNotify, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, firePropertyChange, firePropertyChange, firePropertyChange, fireVetoableChange, getActionForKeyStroke, getActionMap, getAlignmentX, getAlignmentY, getAncestorListeners, getAutoscrolls, getBaseline, getBaselineResizeBehavior, getBorder, getBounds, getClientProperty, getComponentGraphics, getComponentPopupMenu, getConditionForKeyStroke, getDebugGraphicsOptions, getDefaultLocale, getFontMetrics, getGraphics, getHeight, getInheritsPopupMenu, getInputMap, getInputMap, getInputVerifier, getInsets, getInsets, getListeners, getLocation, getMaximumSize, getMinimumSize, getNextFocusableComponent, getPopupLocation, getPreferredSize, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getTopLevelAncestor, getTransferHandler, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, isDoubleBuffered, isLightweightComponent, isManagingFocus, isOpaque, isOptimizedDrawingEnabled, isPaintingForPrint, isPaintingTile, isRequestFocusEnabled, isValidateRoot, paint, paintBorder, paintChildren, paintComponent, paintImmediately, paintImmediately, print, printAll, printBorder, printChildren, printComponent, processComponentKeyEvent, processKeyBinding, processKeyEvent, processMouseEvent, processMouseMotionEvent, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeNotify, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resetKeyboardActions, reshape, revalidate, scrollRectToVisible, setActionMap, setAlignmentX, setAlignmentY, setAutoscrolls, setBackground, setBorder, setComponentPopupMenu, setDebugGraphicsOptions, setDefaultLocale, setDoubleBuffered, setEnabled, setFocusTraversalKeys, setFont, setForeground, setInheritsPopupMenu, setInputMap, setInputVerifier, setMaximumSize, setMinimumSize, setNextFocusableComponent, setOpaque, setPreferredSize, setRequestFocusEnabled, setToolTipText, setTransferHandler, setUI, setVerifyInputWhenFocusTarget, setVisible, unregisterKeyboardAction, update
 
Methods inherited from class java.awt.Container
add, add, add, add, add, addContainerListener, addImpl, addPropertyChangeListener, addPropertyChangeListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalKeys, getFocusTraversalPolicy, getLayout, getMousePosition, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, printComponents, processContainerEvent, processEvent, remove, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusCycleRoot, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setLayout, transferFocusBackward, transferFocusDownCycle, validate, validateTree
 
Methods inherited from class java.awt.Component
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, coalesceEvents, contains, createImage, createImage, createVolatileImage, createVolatileImage, disableEvents, dispatchEvent, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBackground, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getForeground, getGraphicsConfiguration, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocale, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getToolkit, getTreeLock, gotFocus, handleEvent, hasFocus, hide, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isPreferredSizeSet, isShowing, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, postEvent, prepareImage, prepareImage, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processMouseWheelEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, resize, resize, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setFocusable, setFocusTraversalKeysEnabled, setIgnoreRepaint, setLocale, setLocation, setLocation, setName, setSize, setSize, show, show, size, toString, transferFocus, transferFocusUpCycle
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

SMALL_ICON_VIEW_MODE

public static final int SMALL_ICON_VIEW_MODE
Identifies the small icon view mode.

See Also:
Constant Field Values

LARGE_ICON_VIEW_MODE

public static final int LARGE_ICON_VIEW_MODE
Identifies the large icon view mode.

See Also:
Constant Field Values

LIST_VIEW_MODE

public static final int LIST_VIEW_MODE
Identifies the list view mode.

See Also:
Constant Field Values

THUMBNAILS_VIEW_MODE

public static final int THUMBNAILS_VIEW_MODE
Identifies the thumbnails view mode.

See Also:
Constant Field Values
Constructor Detail

XList

public XList()

XList

public XList(Object[] a)

XList

public XList(ListModel model)
Method Detail

updateUI

public void updateUI()
Overrides:
updateUI in class JList

setViewMode

public void setViewMode(int mode)
Sets the XList display mode.

Parameters:
mode - one of 4 legal values:
  • XList.SMALL_ICON_VIEW_MODE
  • XList.LARGE_ICON_VIEW_MODE
  • XList.LIST_VIEW_MODE
  • XList.THUMBNAILS_VIEW_MODE
Throws:
IllegalArgumentException - if the mode illegal

getViewMode

public int getViewMode()
Gets the XList display mode in use.

Returns:
the display mode in use, one of 4 legal values:
  • XList.SMALL_ICON_VIEW_MODE
  • XList.LARGE_ICON_VIEW_MODE
  • XList.LIST_VIEW_MODE
  • XList.THUMBNAILS_VIEW_MODE

setCellPreferredSize

public void setCellPreferredSize(int viewMode,
                                 Dimension size)
Sets the preferred cell size for the specified view mode.

Parameters:
viewMode - the view mode, one of 4 legal values:
  • XList.SMALL_ICON_VIEW_MODE
  • XList.LARGE_ICON_VIEW_MODE
  • XList.LIST_VIEW_MODE
  • XList.THUMBNAILS_VIEW_MODE
size - the preferred cell size
Throws:
IllegalArgumentException - if the viewMode illegal
Since:
JListView 1.4
See Also:
getCellPreferredSize(int)

getCellPreferredSize

public Dimension getCellPreferredSize(int viewMode)
Returns the cell preferred size for the specified view mode.

Parameters:
viewMode - the view mode, one of 4 legal values:
  • XList.SMALL_ICON_VIEW_MODE
  • XList.LARGE_ICON_VIEW_MODE
  • XList.LIST_VIEW_MODE
  • XList.THUMBNAILS_VIEW_MODE
Returns:
the preferred cell size
Throws:
IllegalArgumentException - if the viewMode illegal
Since:
JListView 1.4
See Also:
setCellPreferredSize(int, java.awt.Dimension)

setCellEditor

public void setCellEditor(AbstractCellEditor cellEditor)
Sets the editor.

Parameters:
cellEditor - the cell editor

getCellEditor

public AbstractCellEditor getCellEditor()
Retruns the cell editor.

Returns:
the cell editor

getActionClickCount

public int getActionClickCount()

setActionClickCount

public void setActionClickCount(int actionClickCount)

setElementAt

public void setElementAt(Object o,
                         int index)
Sets the element at the specified index.

Subclass should overide this methods to store the editing value.
The default behavior is determines the model, if it is a java.util.List, set it's value.

Parameters:
o - the editing value
index - the index

isIndexEditable

public boolean isIndexEditable(int index)
Returns true if the speified index is editable.

Parameters:
index - the index to determine
Returns:
true if the specified index is editable

isIndexEditable

public boolean isIndexEditable(int index,
                               EventObject e)
Parameters:
index -
e -
Returns:
Since:
JComponentPack 1.1

isEditing

public boolean isEditing()
Returns true if the XList is being edited.

Returns:
true if the XList is being edited, otherwise return false

stopEditing

public boolean stopEditing()
Stops the current editing.

Returns:
true if the editing is stoped, otherwise return false

cancelEditing

public void cancelEditing()
Cancels the current editing.


startEditingAtIndex

public void startEditingAtIndex(int index)

startEditingAtIndex

public void startEditingAtIndex(int index,
                                EventObject e)

getEditorComponent

public Component getEditorComponent()

getEditingIndex

public int getEditingIndex()
Return the index of current editing.

Returns:
the index of current editing

addActionListener

public void addActionListener(ActionListener listener)
Adds an action listener to the XList.

Parameters:
listener - the listener to add
See Also:
XList(javax.swing.ListModel)

removeActionListener

public void removeActionListener(ActionListener listener)
Removes the specified action listener from the XList.

Parameters:
listener - the listener to remove

getActionListeners

public ActionListener[] getActionListeners()
Returns an array of all the action listeners registered on this XList.

Returns:
all of the XList's ActionListeners or an empty array if no action listeners are currently registered
See Also:
addActionListener(java.awt.event.ActionListener), removeActionListener(java.awt.event.ActionListener)

fireActionPerformed

protected void fireActionPerformed(ActionEvent e)
Notifies all listeners that have registered interest for notification on this event type.

Parameters:
e - the action event to fire
See Also:
EventListenerList

JComponentPack 1.5.0

Send your Feedback
JComponentPack 1.5.0
Copyright © 2001-2007 Extreme Component, Inc. All rights reserved.