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

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, extends Object> getClass, finalize, hashCode, notify, notifyAll, toString, wait, wait, wait

Constructor Details

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 Details

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).

SizeSequence.java -- Copyright (C) 2002, 2006, Free Software Foundation, Inc. This file is part of GNU Classpath. GNU Classpath is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2, or (at your option) any later version. GNU Classpath is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with GNU Classpath; see the file COPYING. If not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. Linking this library statically or dynamically with other modules is making a combined work based on this library. Thus, the terms and conditions of the GNU General Public License cover the whole combination. As a special exception, the copyright holders of this library give you permission to link this library with independent modules to produce an executable, regardless of the license terms of these independent modules, and to copy and distribute the resulting executable under terms of your choice, provided that you also meet, for each linked independent module, the terms and conditions of the license of that module. An independent module is a module which is not derived from or based on this library. If you modify this library, you may extend this exception to your version of the library, but you are not obligated to do so. If you do not wish to do so, delete this exception statement from your version.