javax.swing

Class 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 numEntries, int value)
Creates a new SizeSequence instance with the specified number of elements all having the same size (value).
SizeSequence(int[] sizes)
Creates a new SizeSequence instance using the specified element sizes.
Method Summary
intgetIndex(int position)
Returns the index of the element that contains the specified position.
intgetPosition(int index)
Returns the position of the specified element.
intgetSize(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.
voidinsertEntries(int start, int length, int value)
Inserts new entries into the sequence at the start position.
voidremoveEntries(int start, int length)
Removes the element(s) at index start (the number of elements removed is length).
voidsetSize(int index, int size)
Sets the size of the element at the specified index.
voidsetSizes(int[] sizes)
Sets the sizes for the elements in the sequence.

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

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.

getPosition

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

Parameters: index the element index.

Returns: The 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.

getSizes

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

Returns: The element sizes.

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.

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.

setSizes

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

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