Class tea.set.Folder
All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class tea.set.Folder

java.lang.Object
   |
   +----java.awt.Component
           |
           +----java.awt.Container
                   |
                   +----java.awt.Panel
                           |
                           +----tea.set.Folder

public class Folder
extends Panel
Folder class is a container that provides an interface similar to a file folder. Files can be added to the folder by calling add(String, Component) method. The String argument is the tab name for the file. The Component argument can be another container within which more component can be added, or a simply component which will be resized to fit the content area of the folder. The default size of a folder is the maximum preferred size of its components plus the space for the tabs.

There are four styles of display:

LEFT
tab displayed at left of the folder
BOTTOM
tab displayed at bottom of the folder
RIGHT
tab displayed at right of the folder
TOP
tab displayed at top of the folder
The style of the folder can be set at construction time, or anytime after a Folder has been constructed. The minimumSize and preferredSize of the Folder is only an approximate. For optimum effect, set a reasonable size explicitly.

If tabs don't fit into one row, they are arranged in multiple rows. When a tab is selected, if it's not at the first row, it will be brought to the first row along with other tabs on the same row. An action event is generated when a folder is selected and brought to front. The target of the event is the Folder itself, and the arg is the string containing the tab of the folder file.


Variable Index

 o BOTTOM
Display the tabs at bottom of the folder.
 o LEFT
Display the tabs at left side of the folder.
 o RIGHT
Display the tabs at right side of the folder.
 o TOP
Display the tabs at top of the folder.

Constructor Index

 o Folder()
Create an empty Folder.
 o Folder(int)
Create an empty Folder with specified the style of the folder.

Method Index

 o action(Event, Object)
Action triggered by a tab selection.
 o add(String, Component)
Add a component to the folder.
 o hide(int)
Hide the idx'th tab.
 o hide(String)
Hide the named tab.
 o layout()
Layout the tabs and their associated components.
 o minimumSize()
Return the minimum size of the Folder.
 o paint(Graphics)
Paint the folder.
 o preferredSize()
Return the preferred size of the Folder.
 o reset()
Show a blank page (no tab selected).
 o set3D(boolean)
Set folder 3D mode to true or false.
 o setStyle(int)
Set the folder to a new style.
 o show(int)
Make the idx'th tab visible.
 o show(String)
Make the named tab visible.
 o toFront(int)
Make the idx'th tab the currently displayed one (on the top).
 o toFront(String)
Make the named tab the currently displayed one (on the top).

Variables

 o LEFT
  public final static int LEFT
Display the tabs at left side of the folder.
 o BOTTOM
  public final static int BOTTOM
Display the tabs at bottom of the folder.
 o RIGHT
  public final static int RIGHT
Display the tabs at right side of the folder.
 o TOP
  public final static int TOP
Display the tabs at top of the folder.

Constructors

 o Folder
  public Folder()
Create an empty Folder. The default style is tab at top.
 o Folder
  public Folder(int style)
Create an empty Folder with specified the style of the folder.
Parameters:
style - folder style, one of the style flag values.

Methods

 o setStyle
  public void setStyle(int style)
Set the folder to a new style. The folder will be redrawn after the style is changed.
Parameters:
style - folder style, one of the style flag values.
 o set3D
  public void set3D(boolean mode)
Set folder 3D mode to true or false. The default mode is 3D.
Parameters:
mode - display in 3D if true.
 o add
  public Component add(String name,
                       Component comp)
Add a component to the folder. String is used as the tab name. Component is used as the content.
Parameters:
name - tab string.
comp - folder page content component.
Overrides:
add in class Container
 o show
  public void show(int idx)
Make the idx'th tab visible. Note this function just unhide the tab, but do not make it current. @See toFront().
Parameters:
idx - folder index, in the order of #add
 o show
  public void show(String name)
Make the named tab visible. Note this function just unhide the tab, but do not make it current. @See toFront().
Parameters:
name - tab string.
 o hide
  public void hide(int idx)
Hide the idx'th tab.
Parameters:
idx - folder index, in the order of #add
 o hide
  public void hide(String name)
Hide the named tab.
Parameters:
name - tab string.
 o toFront
  public void toFront(int idx)
Make the idx'th tab the currently displayed one (on the top).
Parameters:
idx - folder index, in the order of #add
 o toFront
  public void toFront(String name)
Make the named tab the currently displayed one (on the top).
Parameters:
name - tab string.
 o reset
  public void reset()
Show a blank page (no tab selected).
 o minimumSize
  public Dimension minimumSize()
Return the minimum size of the Folder.
Returns:
minimum size of folder.
Overrides:
minimumSize in class Container
 o preferredSize
  public Dimension preferredSize()
Return the preferred size of the Folder.
Returns:
preferred size of folder.
Overrides:
preferredSize in class Container
 o action
  public boolean action(Event e,
                        Object arg)
Action triggered by a tab selection. The arg points to the folder itself.
Parameters:
e - event object.
arg - event argument object.
Returns:
false.
Overrides:
action in class Component
 o layout
  public synchronized void layout()
Layout the tabs and their associated components.
Overrides:
layout in class Container
 o paint
  public void paint(Graphics g)
Paint the folder.
Parameters:
g - Graphics content of this component.
Overrides:
paint in class Component

All Packages  Class Hierarchy  This Package  Previous  Next  Index