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 Name | Property Type | Description |
Style | int |
CardFile tab position style flag. |
Border | Insets |
Border space around the content component.
|
PageCount | int(Readonly) |
Number of pages in the CardFile.
|
TabForeground | Color(Indexed, Writeonly) |
Tab foreground color.
|
TabBackground | Color(Indexed, Writeonly) |
Tab background color.
|
TabFont | Font(Indexed, Writeonly) |
Tab text font.
|
3D | boolean |
3D or plain apparence.
|
CardFile generates the following events:
Event Type | Event ID | Generated |
Description |
ActionEvent | ActionEvent.ACTION_PERFORMED |
Tabbed page selected |
ActionEvent.getActionCommand() contains the tab name. |
- See Also:
- Folder
-
eventMgr
- EventMgr object handles added event processing and dispatching.
-
LEFT_RIGHT
- Two pages occupies left and right halves.
-
TOP_BOTTOM
- Two pages occupies top and bottom halves.
-
CardFile()
- Construct an empty Cardfile, defaults to TOP_BOTTOM style.
-
CardFile(int)
- Construct a CardFile with the specified style.
-
add(Component, Object)
- Add a component to serve as one side of a tab card.
-
add(String, Component, Component)
- Add a new card to CardFile.
-
addActionListener(ActionListener)
- Add an action listener.
-
flush()
- This method should be called after all CardFile(String, Component)
calls.
-
getBorder()
- Get the content component border.
-
getIndex(String)
- Get the tab index of the specified tab name.
-
getName(int)
- Get the tab name string of the specified index.
-
getPageCount()
- Get the number of pages inside this folder.
-
getStyle()
- Get the CardFile style.
-
is3D()
- Return the 3D mode flag.
-
processActionEvent(ActionEvent)
- Process and dispatch action event.
-
processEvent(AWTEvent)
- Process and dispatch event.
-
remove(int)
- Remove the specified folder page from the folder.
-
remove(String)
- Remove the named folder page from the folder.
-
removeActionListener(ActionListener)
- Remove an action listener.
-
rename(String, String)
- Rename a folder page tab to a new name.
-
set3D(boolean)
- Set the 3D mode to true or false.
-
setBorder(Insets)
- Set the border for the content component.
-
setStyle(int)
- Set the display style.
-
setTabBackground(int, Color)
-
Set the tab background color.
-
setTabBackground(String, Color)
-
Set the tab background color.
-
setTabFont(int, Font)
-
Set the tab font.
-
setTabFont(String, Font)
-
Set the tab font.
-
setTabForeground(int, Color)
-
Set the tab foreground color.
-
setTabForeground(String, Color)
-
Set the tab background color.
TOP_BOTTOM
public static final int TOP_BOTTOM
- Two pages occupies top and bottom halves.
LEFT_RIGHT
public static final int LEFT_RIGHT
- Two pages occupies left and right halves.
eventMgr
protected EventMgr eventMgr
- EventMgr object handles added event processing and dispatching.
CardFile
public CardFile()
- Construct an empty Cardfile, defaults to TOP_BOTTOM style.
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.
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
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.
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.
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
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.
flush
public void flush()
- This method should be called after all CardFile(String, Component)
calls.
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.
getStyle
public int getStyle()
- Get the CardFile style.
- Returns:
- CardFile style.
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.
getBorder
public Insets getBorder()
- Get the content component border.
- Returns:
- component border.
getPageCount
public int getPageCount()
- Get the number of pages inside this folder.
- Returns:
- number of pages.
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.
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.
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.
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.
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.
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.
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.
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.
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.
is3D
public boolean is3D()
- Return the 3D mode flag.
- Returns:
- true if this folder is in 3D mode.
addActionListener
public void addActionListener(ActionListener listener)
- Add an action listener.
- Parameters:
- listener - action listener.
removeActionListener
public void removeActionListener(ActionListener listener)
- Remove an action listener.
- Parameters:
- listener - action listener.
processEvent
public void processEvent(AWTEvent e)
- Process and dispatch event.
- Parameters:
- e - event object.
- Overrides:
- processEvent in class Container
processActionEvent
public void processActionEvent(ActionEvent e)
- Process and dispatch action event.
- Parameters:
- e - action event.
All Packages Class Hierarchy This Package Previous Next Index