|
||||||||||
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.JTabbedPane
com.neatech.climbplan.userinterface.components.CloseableTabbedPane
public class CloseableTabbedPane
A JTabbedPane which has a close ('X') icon on each tab. To add a tab, use the method addTab(String, Component) To have an extra icon on each tab (e.g. like in JBuilder, showing the file type) use the method addTab(String, Component, Icon). Only clicking the 'X' closes the tab.
Nested Class Summary | |
---|---|
(package private) class |
CloseableTabbedPane.CloseableMetalTabbedPaneUI
A specific MetalTabbedPaneUI . |
(package private) class |
CloseableTabbedPane.CloseableTabbedPaneUI
A specific BasicTabbedPaneUI . |
(package private) class |
CloseableTabbedPane.CloseTabIcon
The class which generates the 'X' icon for the tabs. |
Nested classes/interfaces inherited from class javax.swing.JTabbedPane |
---|
JTabbedPane.AccessibleJTabbedPane, JTabbedPane.ModelListener |
Nested classes/interfaces inherited from class javax.swing.JComponent |
---|
JComponent.AccessibleJComponent |
Nested classes/interfaces inherited from class java.awt.Container |
---|
Container.AccessibleAWTContainer |
Nested classes/interfaces inherited from class java.awt.Component |
---|
Component.AccessibleAWTComponent, Component.BltBufferStrategy, Component.FlipBufferStrategy |
Field Summary | |
---|---|
private JViewport |
headerViewport
The viewport of the scrolled tabs. |
private Icon |
hooverCloseIcon
The closeicon when the mouse is over. |
private EventListenerList |
listenerList
The EventListenerList . |
private Icon |
normalCloseIcon
The normal closeicon. |
private Icon |
pressedCloseIcon
The closeicon when the mouse is pressed. |
private static long |
serialVersionUID
|
Fields inherited from class javax.swing.JTabbedPane |
---|
changeEvent, changeListener, model, SCROLL_TAB_LAYOUT, tabPlacement, WRAP_TAB_LAYOUT |
Fields inherited from class javax.swing.JComponent |
---|
accessibleContext, TOOL_TIP_TEXT_KEY, ui, 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 javax.swing.SwingConstants |
---|
BOTTOM, CENTER, EAST, HORIZONTAL, LEADING, LEFT, NEXT, NORTH, NORTH_EAST, NORTH_WEST, PREVIOUS, RIGHT, SOUTH, SOUTH_EAST, SOUTH_WEST, TOP, TRAILING, VERTICAL, WEST |
Fields inherited from interface java.awt.image.ImageObserver |
---|
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH |
Constructor Summary | |
---|---|
CloseableTabbedPane()
Creates a new instance of CloseableTabbedPane |
|
CloseableTabbedPane(int horizontalTextPosition)
Creates a new instance of CloseableTabbedPane |
Method Summary | |
---|---|
void |
addCloseableTabbedPaneListener(CloseableTabbedPaneListener l)
Adds an CloseableTabbedPaneListener to the tabbedpane. |
void |
addTab(String title,
Component component)
Adds a Component represented by a title and no icon. |
void |
addTab(String title,
Component component,
Icon extraIcon)
Adds a Component represented by a title and an icon. |
protected boolean |
fireCloseTab(int tabIndexToClose)
Notifies all listeners that have registered interest for notification on this event type. |
CloseableTabbedPaneListener[] |
getCloseableTabbedPaneListener()
Returns an array of all the SearchListener s added to this
SearchPane with addSearchListener(). |
private void |
init(int horizontalTextPosition)
Initializes the CloseableTabbedPane |
void |
mouseClicked(MouseEvent e)
Invoked when the mouse button has been clicked (pressed and released) on a component. |
void |
mouseDragged(MouseEvent e)
Invoked when a mouse button is pressed on a component and then dragged. |
void |
mouseEntered(MouseEvent e)
Invoked when the mouse enters a component. |
void |
mouseExited(MouseEvent e)
Invoked when the mouse exits a component. |
void |
mouseMoved(MouseEvent e)
Invoked when the mouse cursor has been moved onto a component but no buttons have been pushed. |
void |
mousePressed(MouseEvent e)
Invoked when a mouse button has been pressed on a component. |
void |
mouseReleased(MouseEvent e)
Invoked when a mouse button has been released on a component. |
private void |
processMouseEvents(MouseEvent e)
Processes all caught MouseEvent s. |
void |
removeCloseableTabbedPaneListener(CloseableTabbedPaneListener l)
Removes an CloseableTabbedPaneListener from the tabbedpane. |
void |
setCloseIcons(Icon normal,
Icon hoover,
Icon pressed)
Allows setting own closeicons. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
private static final long serialVersionUID
private EventListenerList listenerList
EventListenerList
.
private JViewport headerViewport
private Icon normalCloseIcon
private Icon hooverCloseIcon
private Icon pressedCloseIcon
Constructor Detail |
---|
public CloseableTabbedPane()
CloseableTabbedPane
public CloseableTabbedPane(int horizontalTextPosition)
CloseableTabbedPane
horizontalTextPosition
- the horizontal position of the text (e.g.
SwingUtilities.TRAILING or SwingUtilities.LEFT)Method Detail |
---|
private void init(int horizontalTextPosition)
CloseableTabbedPane
horizontalTextPosition
- the horizontal position of the text (e.g.
SwingUtilities.TRAILING or SwingUtilities.LEFT)public void setCloseIcons(Icon normal, Icon hoover, Icon pressed)
normal
- the normal closeiconhoover
- the closeicon when the mouse is overpressed
- the closeicon when the mouse is pressedpublic void addTab(String title, Component component)
Component
represented by a title and no icon.
addTab
in class JTabbedPane
title
- the title to be displayed in this tabcomponent
- the component to be displayed when this tab is clickedpublic void addTab(String title, Component component, Icon extraIcon)
Component
represented by a title and an icon.
title
- the title to be displayed in this tabcomponent
- the component to be displayed when this tab is clickedextraIcon
- the icon to be displayed in this tabpublic void mouseClicked(MouseEvent e)
mouseClicked
in interface MouseListener
e
- the MouseEvent
public void mouseEntered(MouseEvent e)
mouseEntered
in interface MouseListener
e
- the MouseEvent
public void mouseExited(MouseEvent e)
mouseExited
in interface MouseListener
e
- the MouseEvent
public void mousePressed(MouseEvent e)
mousePressed
in interface MouseListener
e
- the MouseEvent
public void mouseReleased(MouseEvent e)
mouseReleased
in interface MouseListener
e
- the MouseEvent
public void mouseDragged(MouseEvent e)
MOUSE_DRAGGED
events will continue to be delivered to the
component where the drag originated until the mouse button is released
(regardless of whether the mouse position is within the bounds of the
component).MOUSE_DRAGGED
events may not be delivered during a native
Drag&Drop operation.
mouseDragged
in interface MouseMotionListener
e
- the MouseEvent
public void mouseMoved(MouseEvent e)
mouseMoved
in interface MouseMotionListener
e
- the MouseEvent
private void processMouseEvents(MouseEvent e)
MouseEvent
s.
e
- the MouseEvent
public void addCloseableTabbedPaneListener(CloseableTabbedPaneListener l)
CloseableTabbedPaneListener
to the tabbedpane.
l
- the CloseableTabbedPaneListener
to be addedpublic void removeCloseableTabbedPaneListener(CloseableTabbedPaneListener l)
CloseableTabbedPaneListener
from the tabbedpane.
l
- the listener to be removedpublic CloseableTabbedPaneListener[] getCloseableTabbedPaneListener()
SearchListener
s added to this
SearchPane
with addSearchListener().
SearchListener
s added or an empty array if
no listeners have been addedprotected boolean fireCloseTab(int tabIndexToClose)
tabIndexToClose
- the index of the tab which should be closed
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |