public final class DefaultTabLayoutModel extends Object
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.
Modifier and Type | Field and Description |
---|---|
protected TabDataModel |
model |
protected int |
padX |
protected int |
padY |
protected JComponent |
renderTarget |
protected int |
textHeight |
Constructor and Description |
---|
DefaultTabLayoutModel(TabDataModel model,
JComponent renderTarget)
Creates a new instance of DefaultTabLayoutModel
|
Modifier and Type | Method and Description |
---|---|
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,
JComponent component) |
protected int |
textWidth(int index) |
protected TabDataModel model
protected int textHeight
protected int padX
protected int padY
protected JComponent renderTarget
public DefaultTabLayoutModel(TabDataModel model, JComponent renderTarget)
protected int iconWidth(int index)
protected int iconHeight(int index)
protected int textWidth(int index)
protected int textHeight(int index, JComponent component)
public int getX(int index)
TabLayoutModel
index
in the data model.getX
in interface TabLayoutModel
index
- The tab indexpublic int getY(int index)
TabLayoutModel
index
in the data model.getY
in interface TabLayoutModel
index
- The tab indexpublic int getH(int index)
TabLayoutModel
index
in the data model.getH
in interface TabLayoutModel
index
- The tab indexpublic int getW(int index)
TabLayoutModel
index
in the data model.getW
in interface TabLayoutModel
index
- The tab indexpublic int indexOfPoint(int x, int y)
TabLayoutModel
indexOfPoint
in interface TabLayoutModel
x
- X coordinate of a point representing a set of pixel coordinate in the space
modeled by this layout modely
- Y coordinatepublic int dropIndexOfPoint(int x, int y)
TabLayoutModel
dropIndexOfPoint
in interface TabLayoutModel
public void setPadding(Dimension d)
setPadding
in interface TabLayoutModel