APIdia Launch Partner
Top Description Fields Constructors Methods
javax.swing.text

public Class TabSet

extends Object
implements Serializable
Class Inheritance
All Implemented Interfaces
java.io.Serializable
Annotations
@SuppressWarnings:serial
Imports
java.io.Serializable

A TabSet is comprised of many TabStops. It offers methods for locating the closest TabStop to a given position and finding all the potential TabStops. It is also immutable.

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 java.beans.XMLEncoder.

Author
Scott Violet

Field Summary

Modifier and TypeField and Description
private int
hashCode

Since this class is immutable the hash code could be calculated once.

private TabStop[]
tabs

TabStops this TabSet contains.

Constructor Summary

AccessConstructor and Description
public
TabSet(TabStop[]
the TabStops to initialize the TabSet
tabs
)

Creates and returns an instance of TabSet.

Method Summary

Modifier and TypeMethod and Description
public boolean

Returns:

true if o is the instance of TabSet, has the same number of TabStops and they are all equal, false otherwise.
equals
(Object
the TabSet instance which this instance should be compared to.
o
)

Overrides java.lang.Object.equals.

Indicates whether this TabSet is equal to another one.

public TabStop

Returns:

the TabStop at index index
getTab
(int
which TapStop to return
index
)

Returns the TabStop at index index.

public TabStop

Returns:

the Tab instance after location
getTabAfter
(float
location to find a Tab after
location
)

Returns the Tab instance after location.

public int

Returns:

the number of Tab instances the receiver contains
getTabCount
()

Returns the number of Tab instances the receiver contains.

public int

Returns:

the index of the TabStop tab, or -1 if tab is not contained in the receiver.
getTabIndex
(TabStop
the TabStop to find
tab
)

Returns the index of the TabStop tab, or -1 if tab is not contained in the receiver.

public int

Returns:

the index of the Tab to be used after location
getTabIndexAfter
(float
location to find a Tab after
location
)

Returns the index of the Tab to be used after location.

public int

Returns:

a hashcode value for this set of TabStops.
hashCode
()

Overrides java.lang.Object.hashCode.

Returns a hashcode for this set of TabStops.

public String
toString()

Overrides java.lang.Object.toString.

Returns the string representation of the set of tabs.

Inherited from java.lang.Object:
clonefinalizegetClassnotifynotifyAllwaitwaitwait

Field Detail

hashCodeback to summary
private int hashCode

Since this class is immutable the hash code could be calculated once. MAX_VALUE means that it was not initialized yet. Hash code shouldn't has MAX_VALUE value.

tabsback to summary
private TabStop[] tabs

TabStops this TabSet contains.

Constructor Detail

TabSetback to summary
public TabSet(TabStop[] tabs)

Creates and returns an instance of TabSet. The array of Tabs passed in must be sorted in ascending order.

Parameters
tabs:TabStop[]

the TabStops to initialize the TabSet

Method Detail

equalsback to summary
public boolean equals(Object o)

Overrides java.lang.Object.equals.

Indicates whether this TabSet is equal to another one.

Parameters
o:Object

the TabSet instance which this instance should be compared to.

Returns:boolean

true if o is the instance of TabSet, has the same number of TabStops and they are all equal, false otherwise.

Since
1.5
getTabback to summary
public TabStop getTab(int index)

Returns the TabStop at index index. This will throw an IllegalArgumentException if index is outside the range of tabs.

Parameters
index:int

which TapStop to return

Returns:TabStop

the TabStop at index index

getTabAfterback to summary
public TabStop getTabAfter(float location)

Returns the Tab instance after location. This will return null if there are no tabs after location.

Parameters
location:float

location to find a Tab after

Returns:TabStop

the Tab instance after location

getTabCountback to summary
public int getTabCount()

Returns the number of Tab instances the receiver contains.

Returns:int

the number of Tab instances the receiver contains

getTabIndexback to summary
public int getTabIndex(TabStop tab)

Returns the index of the TabStop tab, or -1 if tab is not contained in the receiver.

Parameters
tab:TabStop

the TabStop to find

Returns:int

the index of the TabStop tab, or -1 if tab is not contained in the receiver.

getTabIndexAfterback to summary
public int getTabIndexAfter(float location)

Returns the index of the Tab to be used after location. This will return -1 if there are no tabs after location.

Parameters
location:float

location to find a Tab after

Returns:int

the index of the Tab to be used after location

hashCodeback to summary
public int hashCode()

Overrides java.lang.Object.hashCode.

Returns a hashcode for this set of TabStops.

Returns:int

a hashcode value for this set of TabStops.

Since
1.5
toStringback to summary
public String toString()

Overrides java.lang.Object.toString.

Returns the string representation of the set of tabs.