|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjava.awt.Component
java.awt.Container
javax.swing.JComponent
javax.swing.JPanel
net.infonode.tabbedpanel.Tab
A Tab is a component that represents a tab in a TabbedPanel
.
A tab can hold a content component. The content component will then be shown in the content area of the TabbedPanel that the tab is a member of when the tab is selected. If the tab doesn't have a content component, then the TabbedPanel will not show any content in the content area, i.e. it will be empty.
The tab is basically a JPanel with a BorderLayout. The layout manager can be
changed using setLayout. Components and borders can be added and removed from the
tab. The tab can also be subclassed to create other types of tabs, see
TitledTab
. In most cases TitledTab
is the preferred tab type
to use because TitledTab adds support for a text, icon, looks etc.
The tab component will be shown in the tab area of a TabbedPanel after the tab has become a member of that TabbedPanel by either adding or inserting it. A tab can only be a member of one TabbedPanel at the same time.
A tab can have different states when it is a member of a TabbedPanel:
TabListener
,
TabbedPanel
,
TitledTab
,
Serialized FormNested Class Summary |
Nested classes inherited from class javax.swing.JComponent |
JComponent.AccessibleJComponent |
Field Summary |
Fields inherited from class javax.swing.JComponent |
TOOL_TIP_TEXT_KEY, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOW |
Fields inherited from class java.awt.Component |
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT |
Fields inherited from interface java.awt.image.ImageObserver |
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH |
Constructor Summary | |
Tab()
Constructs a tab without a content component and this tab as event component |
|
Tab(JComponent contentComponent)
Constructs a tab with a content component and this tab as event component |
Method Summary | |
void |
addNotify()
|
void |
addTabListener(TabListener listener)
Adds a TabListener |
JComponent |
getContentComponent()
Gets the content component |
JComponent[] |
getEventComponents()
Gets the event components for this Tab |
JComponent |
getFocusableComponent()
Gets the component in this tab that is focusable |
int |
getIndex()
Gets the index of this tab in the TabbedPanel. |
Shape |
getShape()
Gets the tab Shape . |
TabbedPanel |
getTabbedPanel()
Gets the TabbedPanel that this tab is a member of |
boolean |
isHighlighted()
Returns if this tab is highlighted in the TabbedPanel that it is a member of. |
boolean |
isSelected()
Returns if this tab is selected in the TabbedPanel that it is a member of. |
void |
removeNotify()
|
void |
removeTabListener(TabListener listener)
Removes a TabListener |
void |
setEnabled(boolean enabled)
Enable or disable this tab. |
void |
setEventComponent(JComponent eventComponent)
Sets the event component. |
void |
setEventComponents(JComponent[] eventComponents)
Sets a list of event components. |
void |
setFocusableComponent(JComponent focusableComponent)
Sets the component in this tab that represents the focusable part of the tab. |
void |
setHighlighted(boolean highlighted)
Highlights this tab. |
void |
setSelected(boolean selected)
Selects this tab. |
Methods inherited from class javax.swing.JPanel |
getAccessibleContext, getUI, getUIClassID, setUI, updateUI |
Methods inherited from class java.lang.Object |
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
public Tab()
setEventComponent(javax.swing.JComponent)
public Tab(JComponent contentComponent)
contentComponent
- content component for this tab or null for
no content component.setEventComponent(javax.swing.JComponent)
Method Detail |
public void addTabListener(TabListener listener)
listener
- the TabListener to addpublic void removeTabListener(TabListener listener)
listener
- the TabListener to removepublic JComponent getContentComponent()
public TabbedPanel getTabbedPanel()
public void setEnabled(boolean enabled)
Enable or disable this tab.
If the tab is disabled, then the tab will not signal any events until it is enabled again.
enabled
- true for enabled, otherwise falsepublic void setSelected(boolean selected)
Selects this tab. A tab can only have the selected state if it is a member of a TabbedPanel.
Setting selected to true means that this tab will be the selected tab in the TabbedPanel it is a member of. If this tab is the selected tab in the TabbedPanel then setting selected to false means there will be no selected tab in the TabbedPanel until another tab is selected.
selected
- True for selected, otherwise falsepublic boolean isSelected()
public void setHighlighted(boolean highlighted)
highlighted
- true for highlight, otherwise falsepublic boolean isHighlighted()
public void setEventComponent(JComponent eventComponent)
Sets the event component. An event component is a component in the tab that is used for internal listening to mouse events on the tab.
Note: The event component must be part of this Tab
eventComponent
- a component in this tab that should be used for mouse
event listeningpublic void setEventComponents(JComponent[] eventComponents)
Sets a list of event components. An event component is a component in the tab that is used for internal listening to mouse events on the tab. This method makes it possible to use several components in the tab as event components.
Note: The event components must be part of this Tab
eventComponents
- a list of components in this tab that should be used for
mouse event listeningpublic JComponent[] getEventComponents()
public int getIndex()
public JComponent getFocusableComponent()
public void setFocusableComponent(JComponent focusableComponent)
Sets the component in this tab that represents the focusable part of the tab.
Note: The focusable component must be part of this Tab
focusableComponent
- a component in this tab or null if no component
should be focusablepublic Shape getShape()
Gets the tab Shape
.
This returns the shape of the tab. This can be be used by for example content borders in the tabbed panel so they can skip a gap where the tab intersects the tabbed panel content area.
Shape
, null if the tab has the normal component rectangle shapepublic void addNotify()
public void removeNotify()
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |