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

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

org.netbeans.swing.tabcontrol 1.8

org.netbeans.swing.tabcontrol.plaf
Interface TabPainter

All Superinterfaces:
Border

public interface TabPainter
extends Border

An extention to Border which can provide a non-rectangular interior region that will contain the tab's content, and actually paint that interior. The goal of this class is to make it extremely easy to plug in different painting logic without having to write an entire UI delegate.


Method Summary
 void getCloseButtonRectangle(JComponent jc, Rectangle rect, Rectangle bounds)
          Get the close button rectangle for this tab.
 Polygon getInteriorPolygon(Component renderer)
          Get the polygon representing the tag.
 void paintInterior(Graphics g, Component renderer)
          Paint the interior (as defined by getInteriorPolygon()) as appropriate for the tab.
 boolean supportsCloseButton(JComponent renderer)
          Returns true if close button is supported, false otherwise.
 
Methods inherited from interface javax.swing.border.Border
getBorderInsets, isBorderOpaque, paintBorder
 

Method Detail

getInteriorPolygon

Polygon getInteriorPolygon(Component renderer)
Get the polygon representing the tag. Clicks outside this polygon inside the tab's rectangle will be ignored. This polygon makes up the bounds of the tab.

AbstractTabsUI contains generic support for drawing drag and drop target indications. If want to use it rather than write your own, you need to specify the polygon returned by this method with the following point order: The last two points in the point array of the polygon must be the bottom left corner, followed by the bottom right corner. In other words, start at the upper left corner when constructing the polygon, and end at the bottom right corner, using no more than one point for the bottom left and right corners:

 start here -->    /---------
                            |
 finish here -->   ----------
 


paintInterior

void paintInterior(Graphics g,
                   Component renderer)
Paint the interior (as defined by getInteriorPolygon()) as appropriate for the tab. Implementations will presumably use different colors to manage selection, activated state, etc.


getCloseButtonRectangle

void getCloseButtonRectangle(JComponent jc,
                             Rectangle rect,
                             Rectangle bounds)
Get the close button rectangle for this tab. May contain no implementation if supportsCloseButton() returns false."

Parameters:
jc - The current renderer
rect - A rectangle that should be configured with the close button bounds
bounds - The bounds relative to which the close button rectangle should be determined

supportsCloseButton

boolean supportsCloseButton(JComponent renderer)
Returns true if close button is supported, false otherwise.

Parameters:
renderer - The current renderer
Returns:
true if close button is supported, false otherwise

org.netbeans.swing.tabcontrol 1.8

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