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(Component, Object) can also be used to add to CardFile. The first call to add(Component, Object) set the first side of the card, and the second call sets the other side of the card, and so on. If this method is used to add cards to CardFile, CardFile.flush() must be called after all calls to add(Component, Object) are done to ensure the second side of the last page is properly setup.

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.

The content component takes up all available space inside the content page by default. It's often better to leave some space between the component and the folder border. This can be accomplished by calling CardFile.setBorder() method to set the component border.

CardFile supports the following properties:
Property NameProperty TypeDescription
Styleint CardFile tab position style flag.
BorderInsets Border space around the content component.
PageCountint(Readonly) Number of pages in the CardFile.
TabForegroundColor(Indexed, Writeonly) Tab foreground color.
TabBackgroundColor(Indexed, Writeonly) Tab background color.
TabFontFont(Indexed, Writeonly) Tab text font.
3Dboolean 3D or plain apparence.

CardFile generates the following events:
Event TypeEvent IDGenerated Description
ActionEventActionEvent.ACTION_PERFORMED Tabbed page selected ActionEvent.getActionCommand() contains the tab name.

See Also:
Folder

Variable Index

 o eventMgr
EventMgr object handles added event processing and dispatching.
 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 add(Component, Object)
Add a component to serve as one side of a tab card.
 o add(String, Component, Component)
Add a new card to CardFile.
 o addActionListener(ActionListener)
Add an action listener.
 o flush()
This method should be called after all CardFile(String, Component) calls.
 o getBorder()
Get the content component border.
 o getIndex(String)
Get the tab index of the specified tab name.
 o getName(int)
Get the tab name string of the specified index.
 o getPageCount()
Get the number of pages inside this folder.
 o getStyle()
Get the CardFile style.
 o is3D()
Return the 3D mode flag.
 o processActionEvent(ActionEvent)
Process and dispatch action event.
 o processEvent(AWTEvent)
Process and dispatch event.
 o remove(int)
Remove the specified folder page from the folder.
 o remove(String)
Remove the named folder page from the folder.
 o removeActionListener(ActionListener)
Remove an action listener.
 o rename(String, String)
Rename a folder page tab to a new name.
 o set3D(boolean)
Set the 3D mode to true or false.
 o setBorder(Insets)
Set the border for the content component.
 o setStyle(int)
Set the display style.
 o setTabBackground(int, Color)
Set the tab background color.
 o setTabBackground(String, Color)
Set the tab background color.
 o setTabFont(int, Font)
Set the tab font.
 o setTabFont(String, Font)
Set the tab font.
 o setTabForeground(int, Color)
Set the tab foreground color.
 o setTabForeground(String, Color)
Set the tab background color.

Variables

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

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

 o eventMgr
 protected EventMgr eventMgr
EventMgr object handles added event processing and dispatching.

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 synchronized void add(Component comp,
                              Object name)
Add a component to serve as one side of a tab card. The first call add component to the first side of a page, and the second call add component to the second side of a page, and so on. After all calls to this method is done, CardFile.flush() must be called to make sure the second side of the last page is properly setup. If CardFile.flush() is called in the middle of the series of this methods, the add() method following the flush() call will start a new page regardless the current side of the page.

Parameters:
name - tab string.
comp - component for this page.
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 remove
 public void remove(String name)
Remove the named folder page from the folder. The tabs are re-arranged after a page is removed. If a folder has different tab names for its two sides, the entire folder (both sides) are removed.

Parameters:
name - tab string.
 o remove
 public void remove(int idx)
Remove the specified folder page from the folder. The tabs are re-arranged after a page is removed.

Parameters:
idx - tabbed page index.
Overrides:
remove in class Container
 o rename
 public synchronized void rename(String oname,
                                 String name)
Rename a folder page tab to a new name.

Parameters:
oname - the original tab string.
name - the new tab string.
 o flush
 public void flush()
This method should be called after all CardFile(String, Component) calls.

 o setStyle
 public synchronized 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 getStyle
 public int getStyle()
Get the CardFile style.

Returns:
CardFile style.
 o setBorder
 public void setBorder(Insets border)
Set the border for the content component. The border is the space between the component and the folder edges.

Parameters:
border - space between component and the border of folder.
 o getBorder
 public Insets getBorder()
Get the content component border.

Returns:
component border.
 o getPageCount
 public int getPageCount()
Get the number of pages inside this folder.

Returns:
number of pages.
 o getIndex
 public int getIndex(String name)
Get the tab index of the specified tab name. If the tab string is not found, -1 is returned.

Parameters:
name - tab string to search for.
Returns:
tab index of the specified tab string, -1 if not found.
 o getName
 public String getName(int idx)
Get the tab name string of the specified index. The index must be between 0 and the number of tabs minus one. Otherwise a null value is returned. If the tab name for the index is different among two sides of a page, the name on the first side is returned.

Parameters:
idx - tab index.
Returns:
tab name of the specified tab, or null if index is out of range.
 o setTabForeground
 public void setTabForeground(int idx,
                              Color fg)
Set the tab foreground color. This does not affect the page color. If this method is not called, each tab inherites color from the Folder widget.

Parameters:
idx - tab index, starts from 0.
fg - foreground color.
 o setTabForeground
 public void setTabForeground(String name,
                              Color fg)
Set the tab background color. This does not affect the page color. If this method is not called, each tab inherites color from the Folder widget.

Parameters:
name - tab string.
fg - foreground color.
 o setTabBackground
 public void setTabBackground(int idx,
                              Color bg)
Set the tab background color. This does not affect the page color. If this method is not called, each tab inherites color from the Folder widget.

Parameters:
idx - tab index, starts from 0.
fg - background color.
 o setTabBackground
 public void setTabBackground(String name,
                              Color bg)
Set the tab background color. This does not affect the page color. If this method is not called, each tab inherites color from the Folder widget.

Parameters:
name - tab string.
fg - background color.
 o setTabFont
 public void setTabFont(int idx,
                        Font fn)
Set the tab font. This does not affect the page content font. If this method is not called, each tab inherites font from the Folder widget.

Parameters:
idx - tab index, starts from 0.
fn - font.
 o setTabFont
 public void setTabFont(String name,
                        Font fn)
Set the tab font. This does not affect the page content font. If this method is not called, each tab inherites font from the Folder widget.

Parameters:
name - tab name string.
fn - font.
 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.
 o is3D
 public boolean is3D()
Return the 3D mode flag.

Returns:
true if this folder is in 3D mode.
 o addActionListener
 public void addActionListener(ActionListener listener)
Add an action listener.

Parameters:
listener - action listener.
 o removeActionListener
 public void removeActionListener(ActionListener listener)
Remove an action listener.

Parameters:
listener - action listener.
 o processEvent
 public void processEvent(AWTEvent e)
Process and dispatch event.

Parameters:
e - event object.
Overrides:
processEvent in class Container
 o processActionEvent
 public void processActionEvent(ActionEvent e)
Process and dispatch action event.

Parameters:
e - action event.

All Packages  Class Hierarchy  This Package  Previous  Next  Index