public class TabCloseIcon
extends java.lang.Object
implements javax.swing.Icon, java.awt.event.ActionListener
| Modifier and Type | Class and Description |
|---|---|
static interface |
TabCloseIcon.CloseTab
The close tab interface.
|
protected static class |
TabCloseIcon.TabCloseIconMouseListener
The mouse listener for all tab close icons.
|
| Constructor and Description |
|---|
TabCloseIcon()
Creates a new instance of TabCloseIcon.
|
TabCloseIcon(javax.swing.Icon icon)
Creates a new instance of TabCloseIcon.
|
| Modifier and Type | Method and Description |
|---|---|
void |
actionPerformed(java.awt.event.ActionEvent evtObj)
Invoked when a context-popup-menu item is selected.
|
protected void |
closeTab(int idx)
Close the tab by removing it from the tabbed pane.
|
protected boolean |
contains(java.awt.event.MouseEvent e)
Determines if the event happened on the icon.
|
java.awt.Color |
getColor()
Gets the color.
|
static boolean |
getFavoriteTabFlagForTab(javax.swing.JTabbedPane tPaneObj,
java.awt.Component compObj)
Determines whether or not the specified tab is marked as a favorite.
|
int |
getIconHeight()
Returns the icon's height.
|
int |
getIconWidth()
Returns the icon's width.
|
static boolean |
getShowFavTabMenuItemFlag()
Determines whether or not the "Favorite Tab" menu item will be shown
on context popup menus for 'TabCloseIcon' tabs.
|
boolean |
isFavoriteTab()
Determines whether or not this tab is marked as a favorite.
|
protected void |
paintDefaultIcon(java.awt.Component c,
java.awt.Graphics g,
int x,
int y)
Draw the default icon at the specified location.
|
void |
paintIcon(java.awt.Component c,
java.awt.Graphics g,
int x,
int y)
Draw the icon at the specified location.
|
void |
setColor(java.awt.Color colorObj)
Sets the color.
|
void |
setFavoriteTabFlag(boolean flgVal)
Sets whether or not this tab is marked as a favorite.
|
static void |
setFavoriteTabFlagForTab(javax.swing.JTabbedPane tPaneObj,
java.awt.Component compObj,
boolean flgVal)
Sets whether or not the specified tab is marked as a favorite.
|
TabCloseIcon |
setGroup(java.lang.String group,
java.util.Set groupSet)
Sets the group text for the tab.
|
static void |
setShowFavTabMenuItemFlag(boolean flgVal)
Sets whether or not the "Favorite Tab" menu item will be shown on
context popup menus for 'TabCloseIcon' tabs.
|
public TabCloseIcon()
public TabCloseIcon(javax.swing.Icon icon)
icon - the icon or null for the default image.public void actionPerformed(java.awt.event.ActionEvent evtObj)
actionPerformed in interface java.awt.event.ActionListenerevtObj - associated action-event object.public void paintIcon(java.awt.Component c,
java.awt.Graphics g,
int x,
int y)
paintIcon in interface javax.swing.Iconc - the component.g - the graphics.x - the x position.y - the y position.public java.awt.Color getColor()
public int getIconWidth()
getIconWidth in interface javax.swing.Iconpublic int getIconHeight()
getIconHeight in interface javax.swing.Iconpublic void setColor(java.awt.Color colorObj)
colorObj - the color to use.public TabCloseIcon setGroup(java.lang.String group, java.util.Set groupSet)
group - the group text.groupSet - the group set.public void setFavoriteTabFlag(boolean flgVal)
flgVal - true to mark this tab as a favorite; false to not.public boolean isFavoriteTab()
public static void setFavoriteTabFlagForTab(javax.swing.JTabbedPane tPaneObj,
java.awt.Component compObj,
boolean flgVal)
tPaneObj - tabbed pane hosting the tab.compObj - component on tab.flgVal - true to mark tab as a favorite; false to not.public static boolean getFavoriteTabFlagForTab(javax.swing.JTabbedPane tPaneObj,
java.awt.Component compObj)
tPaneObj - tabbed pane hosting the tab.compObj - component on tab.public static void setShowFavTabMenuItemFlag(boolean flgVal)
flgVal - true to show the "Favorite Tab" menu item on the
context popup menus; false to not show.public static boolean getShowFavTabMenuItemFlag()
protected void closeTab(int idx)
idx - the tab index.protected boolean contains(java.awt.event.MouseEvent e)
e - the MouseEvent.protected void paintDefaultIcon(java.awt.Component c,
java.awt.Graphics g,
int x,
int y)
c - the component.g - the graphics.x - the x position.y - the y position.