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

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

org.netbeans.swing.tabcontrol 1.8

org.netbeans.swing.tabcontrol.plaf
Class DefaultTabLayoutModel

java.lang.Object
  extended by org.netbeans.swing.tabcontrol.plaf.DefaultTabLayoutModel
All Implemented Interfaces:
TabLayoutModel

public final class DefaultTabLayoutModel
extends Object

Default implementation of TabLayoutModel. Simply provides a series of rectangles for each tab starting at 0 and ending at the last element, with the width set to the calculated width for the string plus a padding value assigned in setPadding.

To implement TabLayoutModel, it is often useful to create an implementation which wraps an instance of DefaultTabLayoutModel, and uses it to calculate tab sizes.


Field Summary
protected  TabDataModel model
           
protected  int padX
           
protected  int padY
           
protected  JComponent renderTarget
           
protected  int textHeight
           
 
Constructor Summary
DefaultTabLayoutModel(TabDataModel model, JComponent renderTarget)
          Creates a new instance of DefaultTabLayoutModel
 
Method Summary
 int dropIndexOfPoint(int x, int y)
          Gets the index of possibly dropped component (as a new tab).
 int getH(int index)
          Get the height of the tab rectangle for the tab at index index in the data model.
 int getW(int index)
          Get the width of the tab rectangle for the tab at index index in the data model.
 int getX(int index)
          Get the x coordinate of the tab rectangle for the tab at index index in the data model.
 int getY(int index)
          Get the y coordinate of the tab rectangle for the tab at index index in the data model.
protected  int iconHeight(int index)
           
protected  int iconWidth(int index)
           
 int indexOfPoint(int x, int y)
          Get the index of the tab in the data model for the supplied point.
 void setPadding(Dimension d)
           
protected  int textHeight(int index)
           
protected  int textWidth(int index)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

model

protected TabDataModel model

textHeight

protected int textHeight

padX

protected int padX

padY

protected int padY

renderTarget

protected JComponent renderTarget
Constructor Detail

DefaultTabLayoutModel

public DefaultTabLayoutModel(TabDataModel model,
                             JComponent renderTarget)
Creates a new instance of DefaultTabLayoutModel

Method Detail

iconWidth

protected int iconWidth(int index)

iconHeight

protected int iconHeight(int index)

textWidth

protected int textWidth(int index)

textHeight

protected int textHeight(int index)

getX

public int getX(int index)
Description copied from interface: TabLayoutModel
Get the x coordinate of the tab rectangle for the tab at index index in the data model.

Specified by:
getX in interface TabLayoutModel
Parameters:
index - The tab index
Returns:
The coordinate

getY

public int getY(int index)
Description copied from interface: TabLayoutModel
Get the y coordinate of the tab rectangle for the tab at index index in the data model.

Specified by:
getY in interface TabLayoutModel
Parameters:
index - The tab index
Returns:
The coordinate

getH

public int getH(int index)
Description copied from interface: TabLayoutModel
Get the height of the tab rectangle for the tab at index index in the data model.

Specified by:
getH in interface TabLayoutModel
Parameters:
index - The tab index
Returns:
The height

getW

public int getW(int index)
Description copied from interface: TabLayoutModel
Get the width of the tab rectangle for the tab at index index in the data model.

Specified by:
getW in interface TabLayoutModel
Parameters:
index - The tab index
Returns:
The width

indexOfPoint

public int indexOfPoint(int x,
                        int y)
Description copied from interface: TabLayoutModel
Get the index of the tab in the data model for the supplied point.

Specified by:
indexOfPoint in interface TabLayoutModel
Parameters:
x - X coordinate of a point representing a set of pixel coordinate in the space modeled by this layout model
y - Y coordinate
Returns:
The index into the data model of the tab displayed at the passed point or -1

dropIndexOfPoint

public int dropIndexOfPoint(int x,
                            int y)
Description copied from interface: TabLayoutModel
Gets the index of possibly dropped component (as a new tab).

Specified by:
dropIndexOfPoint in interface TabLayoutModel

setPadding

public void setPadding(Dimension d)
Specified by:
setPadding in interface TabLayoutModel

org.netbeans.swing.tabcontrol 1.8

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