Class ListSelectionEvent

java.lang.Object
java.util.EventObject
javax.swing.event.ListSelectionEvent
All Implemented Interfaces:
Serializable

public class ListSelectionEvent extends EventObject
An event that characterizes a change in selection. The change is limited to a single inclusive interval. The selection of at least one index within the range will have changed. A decent ListSelectionModel implementation will keep the range as small as possible. ListSelectionListeners will generally query the source of the event for the new selected status of each potentially changed row.

Warning: Serialized objects of this class will not be compatible with future Swing releases. The current serialization support is appropriate for short term storage or RMI between applications running the same version of Swing. As of 1.4, support for long term storage of all JavaBeans has been added to the java.beans package. Please see XMLEncoder.

See Also:
  • Field Summary

    Fields declared in class EventObject

    source
    Modifier and Type
    Field
    Description
    protected Object
    The object on which the Event initially occurred.
  • Constructor Summary

    Constructors
    Constructor
    Description
    ListSelectionEvent(Object source, int firstIndex, int lastIndex, boolean isAdjusting)
    Represents a change in selection status between firstIndex and lastIndex, inclusive.
  • Method Summary

    Modifier and Type
    Method
    Description
    int
    Returns the index of the first row whose selection may have changed.
    int
    Returns the index of the last row whose selection may have changed.
    boolean
    Returns whether or not this is one in a series of multiple events, where changes are still being made.
    Returns a String that displays and identifies this object's properties.

    Methods declared in class EventObject

    getSource
    Modifier and Type
    Method
    Description
    The object on which the Event initially occurred.

    Methods declared in class Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
    Modifier and Type
    Method
    Description
    protected Object
    Answers a new instance of the same class as the receiver, whose slots have been filled in with the values in the slots of the receiver.
    boolean
    Compares the argument to the receiver, and answers true if they represent the same object using a class specific comparison.
    protected void
    Deprecated, for removal: This API element is subject to removal in a future version.
    May cause performance issues, deadlocks and hangs.
    final Class<? extends Object>
    Answers the unique instance of java.lang.Class which represents the class of the receiver.
    int
    Answers an integer hash code for the receiver.
    final void
    Causes one thread which is waiting on the receiver to be made ready to run.
    final void
    Causes all threads which are waiting on the receiver to be made ready to run.
    final void
    Causes the thread which sent this message to be made not ready to run pending some change in the receiver (as indicated by notify or notifyAll).
    final void
    wait(long time)
    Causes the thread which sent this message to be made not ready to run either pending some change in the receiver (as indicated by notify or notifyAll) or the expiration of the timeout.
    final void
    wait(long time, int frac)
    Causes the thread which sent this message to be made not ready to run either pending some change in the receiver (as indicated by notify or notifyAll) or the expiration of the timeout.
  • Constructor Details

    • ListSelectionEvent

      public ListSelectionEvent(Object source, int firstIndex, int lastIndex, boolean isAdjusting)
      Represents a change in selection status between firstIndex and lastIndex, inclusive. firstIndex is less than or equal to lastIndex. The selection of at least one index within the range will have changed.
      Parameters:
      source - the Object on which the event initially occurred
      firstIndex - the first index in the range, <= lastIndex
      lastIndex - the last index in the range, >= firstIndex
      isAdjusting - whether or not this is one in a series of multiple events, where changes are still being made
  • Method Details

    • getFirstIndex

      public int getFirstIndex()
      Returns the index of the first row whose selection may have changed. getFirstIndex() <= getLastIndex()
      Returns:
      the first row whose selection value may have changed, where zero is the first row
    • getLastIndex

      public int getLastIndex()
      Returns the index of the last row whose selection may have changed. getLastIndex() >= getFirstIndex()
      Returns:
      the last row whose selection value may have changed, where zero is the first row
    • getValueIsAdjusting

      public boolean getValueIsAdjusting()
      Returns whether or not this is one in a series of multiple events, where changes are still being made. See the documentation for ListSelectionModel.setValueIsAdjusting(boolean) for more details on how this is used.
      Returns:
      true if this is one in a series of multiple events, where changes are still being made
    • toString

      public String toString()
      Returns a String that displays and identifies this object's properties.
      Overrides:
      toString in class EventObject
      Returns:
      a string representation of this object