|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object java.awt.Component java.awt.Container java.awt.Panel uic.pjava.widgets.tabbedpane.TabPanel
TabPanel -- allows a user to select from several interface components by clicking a tab at the top of the panel.
Nested Class Summary |
Nested classes inherited from class java.awt.Panel |
Panel.AccessibleAWTPanel |
Nested classes inherited from class java.awt.Container |
Container.AccessibleAWTContainer |
Nested classes inherited from class java.awt.Component |
Component.AccessibleAWTComponent, Component.BltBufferStrategy, Component.FlipBufferStrategy |
Field Summary | |
protected Vector |
aTabSelectionListener
|
protected Polygon |
leftArrow
|
protected boolean |
leftEnabled
|
protected Polygon |
rightArrow
|
protected boolean |
rightEnabled
|
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 | |
TabPanel()
Constructor for the TabPanel |
Method Summary | |
void |
actionPerformed(ActionEvent e)
Handle the popup menu item selections |
protected void |
addImpl(Component comp,
Object constraints,
int index)
Adds a component to the TabPanel |
void |
addTabSelectionListener(TabSelectionListener newListener)
Add a listener who cares about tab selections |
String[] |
determineTabText()
Determines which text will be displayed in the tabs of the Tab panel. |
protected void |
determineVisible()
|
protected void |
drawTabs(Graphics g)
Draws the tabs at the top of the tab panel |
protected void |
fireTabSelected(TabSelectionEvent e)
let those who care know when a tab was selected |
Color |
getBorderColor()
Gets the borderColor property (java.awt.Color) value. |
protected String |
getExplicitTabText(Component c)
|
int |
getFirstVisible()
Get the number of the first-visible physical tab. |
Insets |
getInsets()
Returns the insets of the TabPanel. |
protected PopupMenu |
getPopupMenu()
|
protected int |
getPosition(Object comp)
Return the position of the component in the tabsplitter (its physical tab number) |
String |
getSelectedName()
Get the tab text of the currently-selected component |
int |
getSelectedTabNum()
Get the number of the currently-selected tab |
Color |
getTabBackground()
Gets the color that's behind the tabs |
Color |
getTabColor()
Deprecated. the new tabColors property should be used instead. |
Color[] |
getTabColors()
Get the colors used to draw the tabs. |
Color |
getTabColors(int index)
get a specific tab color. |
String[] |
getTabText()
Gets the explicitly-set tab text array. |
String |
getTabText(int index)
Gets a specific string from the explicitly-set tab text array. |
Object |
getVisibleComponent()
Get the component that is currently visible |
int[] |
getVisibleComponentNum()
Return an array containing the selected tab number. |
protected void |
mergeOrShow(int n)
A convenience method so TabSplitter can add merge capability |
void |
mouseClicked(MouseEvent e)
Dummy method for the MouseListener interface... |
void |
mouseEntered(MouseEvent e)
Dummy method for the MouseListener interface... |
void |
mouseExited(MouseEvent e)
Dummy method for the MouseListener interface... |
void |
mousePressed(MouseEvent e)
handle the mouse button being pressed -- check for right mouse click to bring up popup menu |
void |
mouseReleased(MouseEvent e)
When the mouse is released, check for tab selection |
void |
next()
Move to next tab, wrapping around to first tab if necessary. |
void |
paint(Graphics g)
Paints the tab panel image (tabs, border, background) |
void |
previous()
Move to previous tab, wrapping around to last tab if necessary. |
void |
remove(Component comp)
Remove a component from the container. |
void |
remove(int index)
Remove a component from the container. |
void |
removeAll()
Remove all components from the container. |
void |
removeTabSelectionListener(TabSelectionListener newListener)
Remove a TabSelectionListener. |
protected void |
selectTab(MouseEvent e)
Check to see if the user clicked on a tab or one of the tab panel navigation buttons. |
void |
setBorderColor(Color borderColor)
Sets the borderColor property (java.awt.Color) value. |
protected void |
setExplicitTabText(Component c,
String text)
|
void |
setFirstVisible(int value)
Explicitly sets which tab is the first to be visible |
void |
setFont(Font f)
set the font to use on the tabs |
void |
setSelectedTabNum(int num)
Explicitly pick the selected tab by number. |
void |
setTabBackground(Color color)
set the color to use behind the tabs |
void |
setTabColor(Color color)
Deprecated. the new tabColors property should be used instead. |
void |
setTabColors(Color[] tabColors)
Sets the colors to use when drawing the tabs. |
void |
setTabColors(int index,
Color tabColor)
Sets the colors to use when drawing the tabs. |
void |
setTabText(int index,
String tabText)
Sets the explicit tab text to use when drawing the tabs. |
void |
setTabText(String[] tabText)
Sets the explicit tab text to use when drawing the tabs. |
protected void |
setupTabPolygons()
Creates a Polygon object for each tab. |
void |
shiftLeft()
Shifts the row of tabs one position to the left |
void |
shiftRight()
Shifts the row of tabs one position to the right |
void |
show(Component comp)
Select a tab by component |
void |
show(int n)
Select a tab by number |
void |
show(String tabName)
Select a tab by text |
void |
showPhysicalTab(int n)
Select a tab by number |
protected void |
showPopup(MouseEvent e)
bring up the popup menu for the tabsplitter |
protected boolean |
tabContains(int num,
int x,
int y)
Check to see if the numbered tab contains an x,y location. |
void |
update(Graphics g)
Overridden to get rid of screen erase between drawings |
Methods inherited from class java.awt.Panel |
addNotify, getAccessibleContext |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
protected transient Polygon leftArrow
protected transient Polygon rightArrow
protected boolean leftEnabled
protected boolean rightEnabled
protected transient Vector aTabSelectionListener
Constructor Detail |
public TabPanel()
Method Detail |
public void actionPerformed(ActionEvent e)
actionPerformed
in interface ActionListener
e
- (java.awt.event.ActionEvent) -- the event that was fired to usprotected void addImpl(Component comp, Object constraints, int index)
comp
- (Component) -- the component to be addedconstraints
- (Object) -- constraints on the componentindex
- (int) -- at which position will the component be added (-1 means at end)public void addTabSelectionListener(TabSelectionListener newListener)
newListener
- (TabSelectionListener) -- the component who cares...public String[] determineTabText()
If an explicit text were passed to add(), that text is used (note if the text happens to have the same value as that component's getName() call, it is not considered an explicit text) else if the component implements TabNamedComponent call its getTabName() method to determine the text else if the tabText[] propery was set and the text for that component is non-null use the tabText[tab number] else call getName() as a "last resort"
Note that this method should be used to figure out the tab text, not getTabText(), as getTabText() only gets the tabText[] property.
getTabText()
,
setTabText(java.lang.String[])
protected void determineVisible()
protected void drawTabs(Graphics g)
g
- (Graphics) -- the graphics context into which tabs are drawnprotected void fireTabSelected(TabSelectionEvent e)
e
- (TabSelectionEvent) -- the event to pass to the listenersaddTabSelectionListener(uic.pjava.widgets.tabbedpane.TabSelectionListener)
,
removeTabSelectionListener(uic.pjava.widgets.tabbedpane.TabSelectionListener)
public Color getBorderColor()
setBorderColor(java.awt.Color)
protected String getExplicitTabText(Component c)
public int getFirstVisible()
setFirstVisible(int)
public Insets getInsets()
LayoutManager
protected PopupMenu getPopupMenu()
protected int getPosition(Object comp)
comp
- (Component) -- the component to search for.
public String getSelectedName()
public int getSelectedTabNum()
setSelectedTabNum(int)
public Color getTabBackground()
setTabBackground(java.awt.Color)
public Color getTabColor()
getTabColors()
public Color[] getTabColors()
setTabColors(java.awt.Color[])
public Color getTabColors(int index)
index
- The index value into the property array.
getTabColors()
,
setTabColors(java.awt.Color[])
public String[] getTabText()
setTabText(java.lang.String[])
,
determineTabText()
public String getTabText(int index)
setTabText(java.lang.String[])
,
determineTabText()
public Object getVisibleComponent()
public int[] getVisibleComponentNum()
protected void mergeOrShow(int n)
n
- (int) -- the target tab or a merge or tab to showpublic void mouseClicked(MouseEvent e)
mouseClicked
in interface MouseListener
public void mouseEntered(MouseEvent e)
mouseEntered
in interface MouseListener
public void mouseExited(MouseEvent e)
mouseExited
in interface MouseListener
public void mousePressed(MouseEvent e)
mousePressed
in interface MouseListener
public void mouseReleased(MouseEvent e)
mouseReleased
in interface MouseListener
e
- (MouseEvent)public void next()
public void paint(Graphics g)
g
- (Graphics) The graphics context into which the tab panel is paintedpublic void previous()
public void remove(int index)
index
- (int) Which component to remove.public void remove(Component comp)
comp
- (Component) Which component to remove.public void removeAll()
public void removeTabSelectionListener(TabSelectionListener newListener)
newListener
- com.magelang.tabsplitter.TabSelectionListeneraddTabSelectionListener(uic.pjava.widgets.tabbedpane.TabSelectionListener)
protected void selectTab(MouseEvent e)
e
- (java.awt.event.MouseEvent) The mouse click.public void setBorderColor(Color borderColor)
borderColor
- The new value for the property.getBorderColor()
protected void setExplicitTabText(Component c, String text)
public void setFirstVisible(int value)
value
- (int) the number for the first tabpublic void setFont(Font f)
f
- (Font) -- the font to use when writing tab textpublic void setSelectedTabNum(int num)
num
- int -- the tab number to selectgetSelectedTabNum()
public void setTabBackground(Color color)
color
- (Color) the color to draw behind the tabspublic void setTabColor(Color color)
setTabColors(java.awt.Color[])
public void setTabColors(Color[] tabColors)
tabColors
- The new value for the property.getTabColors()
public void setTabColors(int index, Color tabColor)
tabColor
- The new value for the property.getTabColors()
public void setTabText(String[] tabText)
tabText
- The new value for the property.getTabText()
,
determineTabText()
public void setTabText(int index, String tabText)
index
- (int) the specific text to settabText
- The new value for the property.getTabText()
,
determineTabText()
protected void setupTabPolygons()
public void shiftLeft()
public void shiftRight()
public void show(int n)
n
- (int) the number of the tab to selectpublic void show(Component comp)
comp
- (Component) the main component of the tab to selectpublic void show(String tabName)
tabName
- (String) the text of the tab to be selectedpublic void showPhysicalTab(int n)
n
- (int) the number of the tab to selectprotected void showPopup(MouseEvent e)
e
- (MouseEvent) tells where to bring it upprotected boolean tabContains(int num, int x, int y)
num
- (int) number of the tab to checkx
- (int) x-coord to checky
- (int) y-coord to check
public void update(Graphics g)
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |