All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class symantec.itools.awt.TabPanel

java.lang.Object
   |
   +----java.awt.Component
           |
           +----java.awt.Container
                   |
                   +----java.awt.Panel
                           |
                           +----symantec.itools.awt.BaseTabbedPanel
                                   |
                                   +----symantec.itools.awt.TabPanel

public class TabPanel
extends BaseTabbedPanel
TabPanel is a Panel extension which provides for a tabbed dialog effect. Along the top (by default) of the panel is a series of file folder-like tabs, each with a text label. Each tab is associated with a panel or component that gets shown when the user clicks on the tab. The TabPanel automatically manages swapping panels when a tab selected. It can be used directly or extended. When extending from TabPanel be sure to super() during construction and to super.handleEvent(evt) from handleEvent if you override it.


Constructor Index

 o TabPanel()
Constructs a TabPanel with tabs on top, rounded
 o TabPanel(boolean)
Obsolete.
 o TabPanel(int, int)
Constructs a TabPanel with the tabs in the given position and having the specified look.

Method Index

 o add(Component)
Adds a component to the end of this container.
 o add(Component, int)
Adds a component to the end of this container.
 o add(String, Component)
Takes no action.
 o addTabPanel(String, boolean, Component)
Appends a new tab and associated panel, which will be shown when the tab is selected.
 o countTabs()
Gets the number of tab panels in the TabPanel.
 o enableTabPanel(boolean, int)
Conditionally enables a tab and its associated panel at the given index.
 o getCurrentPanelNdx()
Returns the zero-relative index of the currently selected panel.
 o getPanelLabels()
Gets the current tab labels associated with the panel positions.
 o getPanelTabIndex(Component)
Gets the index for a specific panel.
 o getTabPanel(int)
Gets the panel for the tab at the given index.
 o getTabsOnBottom()
Gets whether the tabs are at the bottom of the dialog.
 o handleEvent(Event)
Processes events for this component.
 o minimumSize()
Returns the minimum dimensions to properly display this component.
 o preferredSize()
Returns the recommended dimensions to properly display this component.
 o remove(Component)
Removes the specified component from this container.
 o removeAllTabPanels()
Removes all tabs and their associated panels, clearing the TabPanel entirely.
 o removeTabPanel(int)
Removes a tab and its associated panel at the given index.
 o setCurrentPanelNdx(int)
Selects the specified tab and shows its associated panel.
 o setPanelLabels(String[])
Sets the tab labels associated with the panel positions.
 o setTabPanel(String, boolean, Component, int)
Replaces a tab and its associated panel at the index specified.
 o setTabsOnBottom(boolean)
Puts the tabs on the top or bottom of the dialog.
 o showTabPanel(int)
Selects the tab at the given index, showing it and its associated panel.
 o updatePanelLabels()
This routine re-sets all the tab labels using the latest string array provided in setPanelLabels().

Constructors

 o TabPanel
  public TabPanel()
Constructs a TabPanel with tabs on top, rounded

 o TabPanel
  public TabPanel(boolean bTabsOnTop)
Obsolete. Use TabPanel(int tabsPostion, int tabsStyle).

 o TabPanel
  public TabPanel(int tabsPostion,
                  int tabsStyle)
Constructs a TabPanel with the tabs in the given position and having the specified look. Note that if the tabs are on top, then they always are rounded.

Parameters:
tabsPosition - a constant indicating TOP or BOTTOM
tabsStyle - a constant indicating ROUNDED or SQUARE
See Also:
TOP, BOTTOM, ROUNDED, SQUARE

Methods

 o addTabPanel
  public int addTabPanel(String sLabel,
                         boolean bEnabled,
                         Component panel)
Appends a new tab and associated panel, which will be shown when the tab is selected. The tab/panel is added after the last existing panel.

Parameters:
sLabel - the tab label
bEnabled - enable the tab or not
panel - the panel to associate with the tab
Returns:
the zero-relative index of the newly added tab panel
 o getCurrentPanelNdx
  public int getCurrentPanelNdx()
Returns the zero-relative index of the currently selected panel.

Returns:
the currently selected panel or -1 if none are shown
See Also:
setCurrentPanelNdx
 o setCurrentPanelNdx
  public void setCurrentPanelNdx(int index)
Selects the specified tab and shows its associated panel.

Parameters:
index - the zero-relative index of the tab to select
See Also:
getCurrentPanelNdx
 o add
  public Component add(Component comp)
Adds a component to the end of this container. This is a standard Java AWT method which gets called to add a component to a container. The specified component is added to the end of this container.

If the tab label for this position has not been set it is given the name "tab - #", where # is the zero-relative index of its position.

Parameters:
comp - the component to add
Returns:
the added component
Overrides:
add in class BaseTabbedPanel
See Also:
remove
 o add
  public synchronized Component add(Component comp,
                                    int pos)
Adds a component to the end of this container. This is a standard Java AWT method which gets called to add a component to a container. Typically, the specified component is added to this container at the given zero-relative position index. A position index of -1 would append the component to the end.

It is overridden so that it only appends to the TabPanel.

If the tab label for this position has not been set it is given the name "tab - #", where # is the zero-relative index of its position.

Parameters:
comp - the component to add
pos - the zero-relative index at which to add the component or -1 for end (IGNORED)
Returns:
the added component
Overrides:
add in class BaseTabbedPanel
See Also:
remove
 o add
  public synchronized Component add(String name,
                                    Component comp)
Takes no action. This is a standard Java AWT method which gets called to add a component to a container. It is overridden here to do nothing, so the user cannot change the way this container works.

Parameters:
comp - the component to add (IGNORED)
Returns:
the component parameter
Overrides:
add in class BaseTabbedPanel
 o remove
  public synchronized void remove(Component comp)
Removes the specified component from this container. This is a standard Java AWT method which gets called to remove a component from a container. When this happens the component's removeNotify() will also get called to indicate component removal.

Parameters:
comp - the component to remove
Overrides:
remove in class BaseTabbedPanel
See Also:
removeAll, add
 o setPanelLabels
  public void setPanelLabels(String sLabels[])
Sets the tab labels associated with the panel positions. Note that the panels do not need to have been added yet for this method to work.

Parameters:
sLabels - an array of tab labels for the panel positions
See Also:
getPanelLabels
 o getPanelLabels
  public String[] getPanelLabels()
Gets the current tab labels associated with the panel positions.

Returns:
an array of tab labels for the panel positions
See Also:
setPanelLabels
 o updatePanelLabels
  public void updatePanelLabels()
This routine re-sets all the tab labels using the latest string array provided in setPanelLabels(). It is not typically called directly.

See Also:
setPanelLabels
 o setTabsOnBottom
  public void setTabsOnBottom(boolean bTabsOnBottom)
Puts the tabs on the top or bottom of the dialog.

Parameters:
bTabsOnBottom - if true the tabs are placed at the bottom of the dialog, if false on top
See Also:
getTabsOnBottom
 o getTabsOnBottom
  public boolean getTabsOnBottom()
Gets whether the tabs are at the bottom of the dialog.

Returns:
true if the tabs are at the bottom of the dialog, false if they are at the top
See Also:
setTabsOnBottom
 o setTabPanel
  public synchronized void setTabPanel(String sLabel,
                                       boolean bEnabled,
                                       Component panel,
                                       int index)
Replaces a tab and its associated panel at the index specified. If it is desired to only change the label, use the base class BaseTabbedPanel's method setTab(String sLabel, boolean bEnabled, int index).

Parameters:
sLabel - the new tab label
bEnabled - enable the tab or not
panel - the new panel
See Also:
setTab, getTabPanel
 o getTabPanel
  public synchronized Component getTabPanel(int index)
Gets the panel for the tab at the given index.

Parameters:
index - zero-relative index of the tab to show
Returns:
returns the Panel associated with the tab
See Also:
setTabPanel
 o getPanelTabIndex
  public synchronized int getPanelTabIndex(Component panel)
Gets the index for a specific panel.

Parameters:
panel - the panel to get the index of
Returns:
the zero-relative index of the panel or -1 if it is not found
 o showTabPanel
  public synchronized void showTabPanel(int index)
Selects the tab at the given index, showing it and its associated panel. The panel is activated, ready for user input. The tab position must be enabled.

Parameters:
index - zero-relative index of the tab to select
See Also:
enableTabPanel
 o enableTabPanel
  public synchronized void enableTabPanel(boolean bEnable,
                                          int index)
Conditionally enables a tab and its associated panel at the given index. The currently active tab cannot be disabled.

Parameters:
bEnable - true to enable, false to disable
index - the zero-relative index of the tab
 o removeTabPanel
  public synchronized void removeTabPanel(int index)
Removes a tab and its associated panel at the given index. The currently active tab cannot be removed.

Parameters:
index - zero-relative index of the tab
 o removeAllTabPanels
  public synchronized void removeAllTabPanels()
Removes all tabs and their associated panels, clearing the TabPanel entirely.

 o countTabs
  public int countTabs()
Gets the number of tab panels in the TabPanel.

Returns:
the number of tab panels currently in the TabPanel
 o handleEvent
  public boolean handleEvent(Event evt)
Processes events for this component. This is a standard Java AWT method which gets called by the AWT to handle this component's events. The default handler for components dispatches to one of the following methods as needed: action(), gotFocus(), lostFocus(), keyDown(), keyUp(), mouseEnter(), mouseExit(), mouseMove(), mouseDrag(), mouseDown(), or mouseUp().

Parameters:
evt - the event to handle
Returns:
true if the event was handled and no further action is needed, false to pass the event to this component's parent
Overrides:
handleEvent in class BaseTabbedPanel
See Also:
action, gotFocus, lostFocus, keyDown, keyUp, mouseEnter, mouseExit, mouseMove, mouseDrag, mouseDown, mouseUp
 o preferredSize
  public Dimension preferredSize()
Returns the recommended dimensions to properly display this component. This is a standard Java AWT method which gets called to determine the recommended size of this component.

The returned size is large enough to display the biggest tab panel at its preferred size.

Overrides:
preferredSize in class BaseTabbedPanel
See Also:
minimumSize
 o minimumSize
  public Dimension minimumSize()
Returns the minimum dimensions to properly display this component. This is a standard Java AWT method which gets called to determine the minimum size of this component.

The returned size is large enough to display the biggest tab panel at its minimum size.

Overrides:
minimumSize in class BaseTabbedPanel
See Also:
preferredSize

All Packages  Class Hierarchy  This Package  Previous  Next  Index