javax.swing
Class SizeSequence

java.lang.Object
  extended by javax.swing.SizeSequence

public class SizeSequence
extends Object

A sequence of values that represent the dimensions (widths or heights) of some collection of items (for example, the widths of the columns in a table).


Constructor Summary
SizeSequence()
          Creates a new empty SizeSequence instance.
SizeSequence(int numEntries)
          Creates a new SizeSequence instance with the specified number of elements, each having a size of 0.
SizeSequence(int[] sizes)
          Creates a new SizeSequence instance using the specified element sizes.
SizeSequence(int numEntries, int value)
          Creates a new SizeSequence instance with the specified number of elements all having the same size (value).
 
Method Summary
 int getIndex(int position)
          Returns the index of the element that contains the specified position.
 int getPosition(int index)
          Returns the position of the specified element.
 int getSize(int index)
          Returns the size of the specified element, or 0 if the element index is outside the defined range.
 int[] getSizes()
          Returns an array containing the sizes for all the elements in the sequence.
 void insertEntries(int start, int length, int value)
          Inserts new entries into the sequence at the start position.
 void removeEntries(int start, int length)
          Removes the element(s) at index start (the number of elements removed is length).
 void setSize(int index, int size)
          Sets the size of the element at the specified index.
 void setSizes(int[] sizes)
          Sets the sizes for the elements in the sequence.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SizeSequence

public SizeSequence()
Creates a new empty SizeSequence instance.


SizeSequence

public SizeSequence(int numEntries)
Creates a new SizeSequence instance with the specified number of elements, each having a size of 0.

Parameters:
numEntries - the number of elements.

SizeSequence

public SizeSequence(int numEntries,
                    int value)
Creates a new SizeSequence instance with the specified number of elements all having the same size (value).

Parameters:
numEntries - the number of elements.
value - the value for each element.

SizeSequence

public SizeSequence(int[] sizes)
Creates a new SizeSequence instance using the specified element sizes.

Parameters:
sizes - the element sizes (null not permitted).
Method Detail

setSize

public void setSize(int index,
                    int size)
Sets the size of the element at the specified index.

Parameters:
index - the index.
size - the size.

getIndex

public int getIndex(int position)
Returns the index of the element that contains the specified position.

Parameters:
position - the position.
Returns:
The index of the element that contains the specified position.

getSize

public int getSize(int index)
Returns the size of the specified element, or 0 if the element index is outside the defined range.

Parameters:
index - the element index.
Returns:
The size of the specified element, or 0 if the element index is outside the defined range.

setSizes

public void setSizes(int[] sizes)
Sets the sizes for the elements in the sequence.

Parameters:
sizes - the element sizes (null not permitted).

getSizes

public int[] getSizes()
Returns an array containing the sizes for all the elements in the sequence.

Returns:
The element sizes.

getPosition

public int getPosition(int index)
Returns the position of the specified element.

Parameters:
index - the element index.
Returns:
The position.

insertEntries

public void insertEntries(int start,
                          int length,
                          int value)
Inserts new entries into the sequence at the start position. There are length new entries each having the specified value.

Parameters:
start - the start element.
length - the number of elements to insert.
value - the size for each of the new elements.

removeEntries

public void removeEntries(int start,
                          int length)
Removes the element(s) at index start (the number of elements removed is length).

Parameters:
start - the index of the first element to remove.
length - the number of elements to remove.