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

Class tea.set.CardFile

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

public class CardFile
extends Panel
CardFile is an interface similar to a day planner with tabbed pages, or card files. Cards can be added to CardFile by calling add(String, Component, Component) method. There are two sides associated with each card, and they are the first and second argument in the add() method call respectively.

The Panel.add(String, Component) can also be used to add to CardFile. If the card associated with the String already has two sides assigned, the add() call is ignored. The first call to add(String, Component) set the first side of the card, and the second call sets the other side of the card. If this method is used to add cards to CardFile, a CardFile.flush() must be called after all calls to add(String, Component) are done. Otherwise some pages may still be in the cache and will not be displayed.

Two styles of display are supported. TOP_BOTTOM style is similar to the card file, with two pages sitting at the top and bottom portions of the screen. LEFT_RIGHT style is similar to a tabbed notebook. There are two pages sitting side by side, and you can flip the pages by clicking on the tabs.

See Also:
Folder

Variable Index

 o LEFT_RIGHT
Two pages occupies left and right halves.
 o TOP_BOTTOM
Two pages occupies top and bottom halves.

Constructor Index

 o CardFile()
Construct an empty Cardfile, defaults to TOP_BOTTOM style.
 o CardFile(int)
Construct a CardFile with the specified style.

Method Index

 o action(Event, Object)
Action to handle flipping pages.
 o add(String, Component)
Add a component to serve as one side of a tab card.
 o add(String, Component, Component)
Add a new card to CardFile.
 o flush()
Need to be called if: add(String, Component) is used, and there is a card only has one side added.
 o set3D(boolean)
Set the 3D mode to true or false.
 o setStyle(int)
Set the display style.

Variables

 o TOP_BOTTOM
  public final static int TOP_BOTTOM
Two pages occupies top and bottom halves.
 o LEFT_RIGHT
  public final static int LEFT_RIGHT
Two pages occupies left and right halves.

Constructors

 o CardFile
  public CardFile()
Construct an empty Cardfile, defaults to TOP_BOTTOM style.
 o CardFile
  public CardFile(int style)
Construct a CardFile with the specified style. The style can either be TOP_BOTTOM or LEFT_RIGHT.
Parameters:
style - style flag of CardFile.

Methods

 o add
  public Component add(String name,
                       Component comp)
Add a component to serve as one side of a tab card. If the card already has two sides, the call is ignored. When adding the first two sides of a card, the two calls to add() must be next to each other. If there are other calls to add() with different tab name in between, the second call to add() will be ignored. When this method is used, CardFile.flush() must be called to make sure the pages held in cache are applied.
Parameters:
name - tab string.
comp - component for this page.
Returns:
this component.
Overrides:
add in class Container
 o add
  public void add(String name,
                  Component c1,
                  Component c2)
Add a new card to CardFile. The name is used as the tab string. The two components are the first side and second side of the card(page) respectively. If a component is null, a blank page will be created.
Parameters:
name - tab string.
c1 - component for first side of this page.
c2 - component for second side of this page.
 o flush
  public void flush()
Need to be called if: add(String, Component) is used, and there is a card only has one side added. The one component is sitting in the cache waiting for the second side to be added. A call of flush() forces the cached to be pushed to the folder.
 o setStyle
  public void setStyle(int s)
Set the display style. This will cause a repaint if the style is different than the current style.
Parameters:
s - style flag.
 o action
  public boolean action(Event e,
                        Object arg)
Action to handle flipping pages.
Parameters:
e - event object.
arg - event argument object.
Returns:
false.
Overrides:
action in class Component
 o set3D
  public void set3D(boolean t)
Set the 3D mode to true or false. The default is true.
Parameters:
t - true if display in 3D mode.

All Packages  Class Hierarchy  This Package  Previous  Next  Index