站内搜索: 请输入搜索关键词
当前页面: 在线文档首页 > NetBeans API Javadoc (Current Development Version)

TabData (Tab Control) - NetBeans API Javadoc (Current Development Version)

org.netbeans.swing.tabcontrol 1.8

org.netbeans.swing.tabcontrol
Class TabData

java.lang.Object
  extended by org.netbeans.swing.tabcontrol.TabData
All Implemented Interfaces:
Comparable

public final class TabData
extends Object
implements Comparable

Class representing data needed to represent a component in a tab. While immutable to client code, changes to the data model may change the values returned by the methods of this class. TabData objects are the data component of TabDataModel.

TabData objects implement their equals() and hashCode contract based on the equality of the user object and the text. The icon and the tooltip text are not considered when testing equality.

See Also:
TabDataModel, DefaultTabDataModel

Constructor Summary
TabData(Object userObject, Icon i, String caption, String tooltip)
          Create a new TabData object.
 
Method Summary
 int compareTo(Object o)
          Compares the text based on java.lang.String's implementation of Comparable.
 boolean equals(Object o)
          Returns true if the text and component properties of this TabData object match the passed one.
 Component getComponent()
          The component for the tab.
 Icon getIcon()
          The icon for the tab.
 String getText()
          The text for the tab
 String getTooltip()
          The tooltip for the tab
 Object getUserObject()
           
 int hashCode()
          Munges the text and component hash codes
 String toString()
          Get a string representation of this object
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

TabData

public TabData(Object userObject,
               Icon i,
               String caption,
               String tooltip)
Create a new TabData object.

Parameters:
userObject - The object or component that should be displayed when the tab is selected. For use in TabbedContainer, this should be an instance of java.awt.Component
i - The icon for the tab
caption - The caption for the tab
tooltip - The tooltip for the tab
Method Detail

getUserObject

public Object getUserObject()

getComponent

public Component getComponent()
The component for the tab. Returns null if the user object is not an instance of Component.

Returns:
The component

getIcon

public Icon getIcon()
The icon for the tab. Note that this method is guaranteed to return non-null - if the icon specified is null, a 0-width, 0-height icon whose paintIcon method is a no-op will be returned.

Returns:
The icon

getText

public String getText()
The text for the tab

Returns:
The text

getTooltip

public String getTooltip()
The tooltip for the tab

Returns:
The tooltip text

toString

public String toString()
Get a string representation of this object

Overrides:
toString in class Object
Returns:
String representation of this object

equals

public boolean equals(Object o)
Returns true if the text and component properties of this TabData object match the passed one. Tooltip and icon equality are not evaluated.

Overrides:
equals in class Object

hashCode

public int hashCode()
Munges the text and component hash codes

Overrides:
hashCode in class Object

compareTo

public int compareTo(Object o)
Compares the text based on java.lang.String's implementation of Comparable.

Specified by:
compareTo in interface Comparable

org.netbeans.swing.tabcontrol 1.8

Built on May 28 2007.  |  Portions Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.