Developer Documentation
PATH  Mac OS X Documentation > Application Kit Reference: Java

Table of Contents

NSTabViewItem


Inherits from:
NSObject
Package:
com.apple.yellow.application


Class Description



Note: The NSTabView class and its supporting class NSTabViewItem are under development. If you want to use these classes, you will have to instantiate them programmatically because Interface Builder does not yet include support for them.

An NSTabView provides a convenient mechanism for presenting information in a multi-page format. A tab view is usually distinguished by a row of tabs that give the visual appearance of folder tabs. When the user clicks on a tab, the tab view displays a view page provided by your application.

A tab view keeps a zero-based array of NSTabViewItems, one for each tab in the view. A tab view item provides access to the tab's color, state, label text, initial first responder, and associated view. Your application can supply each tab view item with an optional identifier object to customize tab handling.




Method Types


Constructors
NSTabViewItem
Working with labels
drawLabel
label
setLabel
sizeOfLabel
Checking the tab display state
tabState
Assigning an identifier object
identifier
setIdentifier
Setting the color
color
setColor
Assigning a view
view
setView
Setting the initial first responder
initialFirstResponder
setInitialFirstResponder
Accessing the parent tab view
tabView


Constructors



NSTabViewItem

public NSTabViewItem()

Description forthcoming.

public NSTabViewItem(Object identifier)

Performs default initialization for the tab view item. Sets the item's identifier object to identifier, if it is not null. Use this constructor when creating tab view items programmatically.

See Also: identifier, setIdentifier




Instance Methods



color

public NSColor color()

Returns the color for the tab view item. By default, the color is set to the system color used for the flat surfaces of a control.

See Also: setColor



drawLabel

public void drawLabel( boolean shouldTruncateLabel, NSRect tabRect)

Draws the tab view item's label in tabRect. If shouldTruncateLabel is false, draws the full label in the rect specified by tabRect. If shouldTruncateLabel is true, draws the truncated label. You can override this method to perform customized label drawing. For example, you might want to add an icon to each tab in the view.

See Also: sizeOfLabel



identifier

public Object identifier()

Returns the tab view item's optional identifier object. To customize how your application works with tabs, you can initialize each tab view item with an identifier object.

See Also: setIdentifier



initialFirstResponder

public Object initialFirstResponder()

Returns the initial first responder for the view associated with the tab view item.

See Also: setInitialFirstResponder



label

public String label()

Returns the label text for the tab view item.

See Also: setLabel



setColor

public void setColor(NSColor color)

Sets the color for the tab view item to color.

See Also: color



setIdentifier

public void setIdentifier(Object identifier)

Sets the tab view item's optional identifier object to identifier. To customize how your application works with tabs, you can specify an identifier object for each tab view item.

See Also: identifier



setInitialFirstResponder

public void setInitialFirstResponder(NSView view)

Sets the initial first responder for the view associated with the tab view item (the view that is displayed when a user clicks on the tab) to view.

See Also: initialFirstResponder



setLabel

public void setLabel(String label)

Sets the label text for the tab view item to label.

See Also: label



setView

public void setView(NSView view)

Sets the view associated with the tab view item to view. This is the view displayed when a user clicks on the tab.

See Also: view



sizeOfLabel

public NSSize sizeOfLabel(boolean shouldTruncateLabel)

Calculates the size of the tab view item's label. If shouldTruncateLabel is false, returns the size of the tab view item's full label. If shouldTruncateLabel is true, returns the truncated size. If your application does anything to change the size of tab labels, such as overriding the drawLabel method to add an icon to each tab, you should override sizeOfLabel too so the NSTabView knows the correct size for the tab label.

See Also: drawLabel, setFont (NSTabView)



tabState

public int tabState()

Returns the current display state of the tab associated with this tab view item. The possible values are NSTabView.SelectedTab, NSTabView.BackgroundTab, or NSTabView.PressedTab. Your application does not directly set the tab state.

tabView

public NSTabView tabView()

Returns the parent tab view for the tab view item. Note that this is the tab view itself, not the view displayed when a user clicks on the tab.

A tab view item normally learns about its parent tab view when it is inserted into the view's array of items. The NSTabView methods addTabViewItem and insertTabViewItem set the tab view for the added or inserted item.

See Also: setView, view



view

public NSView view()

Returns the view associated with the tab view item. This is the view displayed when a user clicks on the tab.

See Also: setView




Table of Contents