    All Packages  Class Hierarchy  This Package  Previous  Next  Index

# Class jclass.bwt.JCTabManager

    java.lang.Object
       |
       +----java.awt.Component
               |
               +----java.awt.Container
                       |
                       +----java.awt.Panel
                               |
                               +----jclass.bwt.JCContainer
                                       |
                                       +----jclass.bwt.JCTabManager

public class JCTabManager
extends JCContainer

JCTabManager is a container which organizes its children into pages to simulate a sequence of file folders. A row of tab buttons allows users to select a page. The page components are defined as children of the Tab Manager; a property is then used to associated a page with a particular tab button. Page components can be of any class (including any container). Because AWT components must be rectangular, the tab buttons are not actual buttons, but are simulated.

Properties

Name | Method
--- | ---
Alignment | setAlignment
Background | setBackground
CurrentTabFont | setCurrentTabFont
FirstVisibleTab | setFirstVisibleTab
Font | setFont
Foreground | setForeground
Insets | setInsets
PreferredSize | setPreferredSize
TabColorPolicy | setTabColorPolicy
TabLabels | setTabLabels
TabResize | setTabResize
TabShape | setTabShape
TabSide | setTabSide
TabSpacing | setTabSpacing
TabStretch | setTabStretch
UserData | setUserData

Events

Class | Listener | Description
--- | --- | ---
JCTabManagerEvent | addTabManagerListener | Posted when the page changes

##

BOTTOM
BOTTOMCENTER
BOTTOMLEFT
BOTTOMRIGHT
CENTER
COLOR_INHERIT
COLOR_PAGE
LEFT
listeners
  List of JCTabManagerEvent listeners
MIDDLE
MIDDLECENTER
MIDDLELEFT
MIDDLERIGHT
page_area
  The container which holds the pages.
RECTANGLE
RIGHT
SLANTED
tab_panel
  The container which holds the tab buttons.
TOP
TOPCENTER
TOPLEFT
TOPRIGHT

##

JCTabManager()
  Creates an empty TabManager.
JCTabManager(Applet, String)
  Creates a TabManager which reads parameters from the applet's HTML file.

##

add(Component)
  Adds the specified component as a page.
addPage(Object, Component)
  Adds a page and creates a tab for it.
addTabManagerListener(JCTabManagerListener)
  Adds the specified JCTabManagerEvent listener to receive value change events.
getAlignment()
  Gets the default tab alignment.
getCurrentPage()
  Gets the current page.
getCurrentTab()
  Gets the current tab.
getCurrentTabFont()
  Gets the CurrentTabFont value.
getFirstVisibleTab()
  Gets the first visible tab.
getPages()
  Gets a list of all the pages.
getParameters()
  Reads the parameter values from the HTML page using the component's applet.
getTab(int)
  Gets the tab at the specified position.
getTab(JCTabButton)
  Gets the position of the specified tab.
getTabColorPolicy()
  Gets the TabColorPolicy value.
getTabLabels()
  Gets the tab labels as a list of Strings.
getTabResize()
  Gets the TabResize value.
getTabs()
  Gets a list of all the tabs.
getTabShape()
  Gets the tab shape.
getTabSide()
  Gets the TabSide value.
getTabSpacing()
  Gets the TabSpacing value.
getTabStretch()
  Gets the TabStretch value.
makeTabVisible(int)
  Scrolls the tabs if necessary so that the tab is fully visible.
removeTab(int, boolean)
  Removes a tab and optionally its page.
removeTabManagerListener(JCTabManagerListener)
  Removes the specified listener so it no longer receives JCTabManagerEvents.
reshape(int, int, int, int)
  Reshapes the Container to the specified bounding box.
setAlignment(int)
  Sets the default position of the tab's label within its shadows.
setCurrentPage(Component)
  Sets the current page.
setCurrentTab(int, boolean)
  Sets the current tab, and posts a JCTabMangerEvent.
setCurrentTabFont(Font)
  Sets the current tab's font (default: bold version of default font).

  HTML param name/value: "CurrentTabFont"/Font

setFirstVisibleTab(int)
  Sets the first tab currently visible.
setLayout(LayoutManager)
  Sets the layout manager for this container.
setTabColorPolicy(int)
  Sets the policy for the tab's colors:

       COLOR_PAGE        Sets the tab's color to the page's color (default)
       COLOR_INHERIT     Sets the tab's color to the tab manager's color

  HTML param name/value: "TabColorPolicy"/enum
setTabLabels(String[])
  Sets the tab's labels.

  HTML param name/value: "TabLabels"/string list

setTabPage(int, Object, Component)
  Sets the page associated with a tab.
setTabResize(boolean)
  Sets whether all tabs should be resized to the width or height of the largest tab in the same row, depending on the value of the TabSide value.
setTabShape(int)
  Sets the tab's shape: RECTANGLE (default), or SLANTED.

  HTML param name/value: "TabShape"/enum

setTabSide(int)
  Sets the side on which tabs are to be displayed: TOP (default), or BOTTOM.

  HTML param name/value: "TabSide"/enum

setTabSpacing(int)
  Sets the spacing between tabs in pixels (default: 0).
setTabStretch(boolean)
  Sets whether all tabs should be stretched if necessary to fill the entire side (default: false).

  HTML param name/value: "TabStretch"/boolean

##

TOPLEFT

      public final static int TOPLEFT

LEFT

      public final static int LEFT

TOPCENTER

      public final static int TOPCENTER

CENTER

      public final static int CENTER

TOPRIGHT

      public final static int TOPRIGHT

RIGHT

      public final static int RIGHT

MIDDLELEFT

      public final static int MIDDLELEFT

MIDDLECENTER

      public final static int MIDDLECENTER

MIDDLE

      public final static int MIDDLE

MIDDLERIGHT

      public final static int MIDDLERIGHT

BOTTOMLEFT

      public final static int BOTTOMLEFT

BOTTOMCENTER

      public final static int BOTTOMCENTER

BOTTOMRIGHT

      public final static int BOTTOMRIGHT

COLOR_PAGE

      public final static int COLOR_PAGE

COLOR_INHERIT

      public final static int COLOR_INHERIT

RECTANGLE

      public final static int RECTANGLE

SLANTED

      public final static int SLANTED

TOP

      public final static int TOP

BOTTOM

      public final static int BOTTOM

tab_panel

      protected TabPanel tab_panel

  The container which holds the tab buttons.

page_area

      protected TabPageArea page_area

  The container which holds the pages.

listeners

      protected JCVector listeners

  List of JCTabManagerEvent listeners

##

JCTabManager

      public JCTabManager()

  Creates an empty TabManager. No parameters are read from an HTML file.

JCTabManager

      public JCTabManager(Applet applet,
                          String name)

  Creates a TabManager which reads parameters from the applet's HTML file.

  Parameters:
    applet - the applet whose PARAM tags are to be read
    name - if this is not null, only parameters preceded by this name are read
  See Also:
    getParameter

##

getParameters

      protected void getParameters()

  Reads the parameter values from the HTML page using the component's applet. The values will override those previously set.

  Overrides:
    getParameters in class JCContainer

addTabManagerListener

      public void addTabManagerListener(JCTabManagerListener l)

  Adds the specified JCTabManagerEvent listener to receive value change events.

  See Also:
    JCTabManagerEvent

removeTabManagerListener

      public void removeTabManagerListener(JCTabManagerListener l)

  Removes the specified listener so it no longer receives JCTabManagerEvents.

  See Also:
    addTabManagerListener

getPages

      public Component[] getPages()

  Gets a list of all the pages.

  See Also:
    setPage, addPage

getTabs

      public JCTabButton[] getTabs()

  Gets a list of all the tabs.

  See Also:
    setPage, addPage

getTab

      public int getTab(JCTabButton tab)

  Gets the position of the specified tab.

  Returns:
    BWTEnum.NOTFOUND if the tab is not a child

getTab

      public JCTabButton getTab(int pos)

  Gets the tab at the specified position.

  Returns:
    null if the position is invalid

getAlignment

      public int getAlignment()

  Gets the default tab alignment.

  See Also:
    setAlignment

setAlignment

      public synchronized void setAlignment(int align)

  Sets the default position of the tab's label within its shadows.

  Parameters:
    align - one of TOPLEFT, TOPCENTER, TOPRIGHT, MIDDLELEFT, MIDDLECENTER (default), MIDDLERIGHT, BOTTOMLEFT, BOTTOMCENTER and BOTTOMRIGHT
  Throws: IllegalArgumentException
    If an invalid value is set

getTabColorPolicy

      public int getTabColorPolicy()

  Gets the TabColorPolicy value.

  See Also:
    setTabColorPolicy

setTabColorPolicy

      public synchronized void setTabColorPolicy(int v)

  Sets the policy for the tab's colors:

       COLOR_PAGE        Sets the tab's color to the page's color (default)
       COLOR_INHERIT     Sets the tab's color to the tab manager's color

  HTML param name/value: "TabColorPolicy"/enum

  Throws: IllegalArgumentException
    If an invalid value is set

getTabSpacing

      public int getTabSpacing()

  Gets the TabSpacing value.

  See Also:
    setTabSpacing

setTabSpacing

      public void setTabSpacing(int v)

  Sets the spacing between tabs in pixels (default: 0). When set to a negative value, the tabs overlap.

  HTML param name/value: "TabSpacing"/int

getCurrentTab

      public int getCurrentTab()

  Gets the current tab.

  See Also:
    setCurrentTab

setCurrentTab

      public synchronized void setCurrentTab(int tab_pos,
                                             boolean show_page)

  Sets the current tab, and posts a JCTabMangerEvent.

  Parameters:
    tab_pos - the tab position
    show_page - if true, the tab's page is displayed - a blank page is displayed if the tab is non-existent; if show_page is false, the current page is not changed
  See Also:
    addTabManagerListener

getCurrentTabFont

      public Font getCurrentTabFont()

  Gets the CurrentTabFont value.

  See Also:
    setCurrentTabFont

setCurrentTabFont

      public synchronized void setCurrentTabFont(Font font)

  Sets the current tab's font (default: bold version of default font).

  HTML param name/value: "CurrentTabFont"/Font

  See Also:
    toFont

getCurrentPage

      public Component getCurrentPage()

  Gets the current page.

  See Also:
    setCurrentPage

setCurrentPage

      public synchronized void setCurrentPage(Component page)

  Sets the current page. The current tab is not changed - call setCurrentTab to set a tab and its page as current.

  Parameters:
    page - if null, a blank page is displayed
  See Also:
    setCurrentTab

getTabShape

      public int getTabShape()

  Gets the tab shape.

  See Also:
    setTabShape

setTabShape

      public synchronized void setTabShape(int v)

  Sets the tab's shape: RECTANGLE (default), or SLANTED.

  HTML param name/value: "TabShape"/enum

  Throws: IllegalArgumentException
    If an invalid value is set

getTabLabels

      public String[] getTabLabels()

  Gets the tab labels as a list of Strings.

  See Also:
    setTabLabels

setTabLabels

      public synchronized void setTabLabels(String v[])

  Sets the tab's labels.

  HTML param name/value: "TabLabels"/string list

  See Also:
    addPage

getFirstVisibleTab

      public int getFirstVisibleTab()

  Gets the first visible tab.

  See Also:
    setFirstVisibleTab

setFirstVisibleTab

      public synchronized void setFirstVisibleTab(int tab_pos)

  Sets the first tab currently visible. Setting this value causes the tabs to scroll if necessary so that the tab is fully visible.

  HTML param name/value: "FirstVisibleTab"/int

makeTabVisible

      public synchronized void makeTabVisible(int tab_pos)

  Scrolls the tabs if necessary so that the tab is fully visible.

  See Also:
    setFirstVisibleTab

getTabResize

      public boolean getTabResize()

  Gets the TabResize value.

  See Also:
    setTabResize

setTabResize

      public synchronized void setTabResize(boolean v)

  Sets whether all tabs should be resized to the width or height of the largest tab in the same row, depending on the value of the TabSide value. If true (default), this property is processed before TabStretch.

  HTML param name/value: "TabResize"/boolean

  See Also:
    setTabStretch

getTabSide

      public int getTabSide()

  Gets the TabSide value.

  See Also:
    setTabSide

setTabSide

      public synchronized void setTabSide(int v)

  Sets the side on which tabs are to be displayed: TOP (default), or BOTTOM.

  HTML param name/value: "TabSide"/enum

  Throws: IllegalArgumentException
    If an invalid value is set

getTabStretch

      public boolean getTabStretch()

  Gets the TabStretch value.

  See Also:
    setTabStretch

setTabStretch

      public synchronized void setTabStretch(boolean v)

  Sets whether all tabs should be stretched if necessary to fill the entire side (default: false).

  HTML param name/value: "TabStretch"/boolean

  See Also:
    setTabResize

setTabPage

      public synchronized int setTabPage(int tab_pos,
                                         Object label,
                                         Component page)

  Sets the page associated with a tab. Several tabs may share a common page.

  Parameters:
    tab_pos - the position of the tab to be set; if this is greater than the current number of tabs, a new tab will be created
    label - the tab's label; this may be a String, Image, JCString, or any object (in which case the object's toString() method is called to obtain a string) If null, any tab label set previously using setTabLabels will be used.
    page - may be null if no page is to be associated with the tab; a page may be set later using JCTabButton.setPage
  Returns:
    the position of the tab that was set (which may be a new tab)
  See Also:
    getTab, setTabLabels, setPage, JCString

addPage

      public synchronized int addPage(Object label,
                                      Component page)

  Adds a page and creates a tab for it.

  Parameters:
    label - the tab's label; this may be a String, Image, JCString or any object (in which case the object's toString() method is called to obtain a string). If null, any tab label set previously using setTabLabels will be used.
    page - may be null if no page is to be associated with the tab; a page may be set later using JCTabButton.setPage
  Returns:
    the position of the new tab
  See Also:
    getTab, setTabLabels, setPage, JCString

removeTab

      public synchronized void removeTab(int tab_pos,
                                         boolean remove_page)

  Removes a tab and optionally its page.

  Parameters:
    tab_pos - the position of the tab to be removed
  See Also:
    getTab

add

      public Component add(Component page)

  Adds the specified component as a page.

  Overrides:
    add in class JCContainer
  See Also:
    addPage

setLayout

      public final void setLayout(LayoutManager mgr)

  Sets the layout manager for this container. This method is overridden to prevent the layout mgr from being set.

  Overrides:
    setLayout in class Container

reshape

      public synchronized void reshape(int x,
                                       int y,
                                       int width,
                                       int height)

  Reshapes the Container to the specified bounding box.

  Overrides:
    reshape in class JCContainer

    All Packages  Class Hierarchy  This Package  Previous  Next  Index