[
Previous section |
Next section |
This Package |
Package List |
Table of Contents
]
Class Notebook
public class extend.awt.Notebook extends java.awt.Panel {
public static final int Top
public static final int Left
public static final int Right
public static final int Bottom
public static final int Simple
public static final int Spiral
public static final String Separator
public Notebook(int, int)
public void setOrientation(int)
public int getOrientation()
public void setStyle(int)
public void getStyle()
public void setOrientationAndStyle(int, int)
public void addPage(Object, Component, PageVerifier)
public void addPage(Object, Color, Component, PageVerifier)
public void addPage(Object, Color, Color, Component, PageVerifier)
public String pageShowing()
public void verifyPage()
public void turnToPage(Object, int)
}
The Notebook class provides a notebook control for managing multiple
page dialogs with the user.
Top
public final static int Top
- Used to set notebook tabs across the top of the notebook. Not
valid for Spiral notebooks.
Left
public final static int Left
- Used to set notebook tabs on the left side of the notebook. Not
valid for Spiral notebooks.
Right
public final static int Right
- Used to set notebook tabs on the right side of the
notebook.
Bottom
public final static int Bottom
- Used to set notebook tabs across the bottom of the
notebook.
Simple
public final static int Simple
- Used to display the notebook as a simple, square tab
notebook.
Spiral
public final static int Spiral
- Used to display the notebook as a three dimensional notebook
with a spiral binding.
Separator
public final static String Separator
- Used to define the string which separates the tab name and current
tab page number in the string returned by the pageShowing() method.
Notebook
public Notebook (int side, int style)
- This is the only constructor for the Notebook class. It
constructs the notebook and sets the tab location and look based on the
arguments.
- Parameters:
side -
Indicates the side of the notebook where the
tabs should go. It must be one of Top, Left, Right or Bottom.
style -
Indicates the style of the notebook. It must
be either Simple or Spiral. Note that the Spiral style only allows tabs on
the Right and Bottom.
- Throws:
- IllegalArgumentException
This exception is thrown when any argument is not valid. It is also
thrown when the side and style arguments conflict (Top and Spiral are
conflicting values).
setOrientation
public void setOrientation (int side)
- This method will change the location of the tabs on the notebook
to the side indicated by the argument.
- Parameters:
side -
Indicates the side of the notebook where the
tabs should go. It must be one of Top, Left, Right or Bottom.
- Throws:
- IllegalArgumentException
This exception is thrown when any argument is not valid.
getOrientation
public int getOrientation ()
- This method retuns the current location of the tabs on the notebook.
- Returns:
- This method returns an int.
setStyle
public void setStyle (int style)
- This method will change the style of the notebook to that
indicated by the argument.
- Parameters:
style -
Indicates the style of the notebook. It must
be either Simple or Spiral. Note that the Spiral style only allows tabs on
the Right and Bottom.
- Throws:
- IllegalArgumentException
This exception is thrown when any argument is not valid. It is also
thrown when the side and style arguments conflict (Top and Spiral are
conflicting values).
getStyle
public int getStyle ()
- This method retuns the current style (or look) of the notebook.
- Returns:
- This method returns an int.
setOrientationAndStyle
public void setOrientationAndStyle (int side, int style)
- This method will change both the location of the tabs on the
notebook to the side indicated by the first argument and the style to
the second.
- Parameters:
side -
Indicates the side of the notebook where the
tabs should go. It must be one of Top, Left, Right or Bottom.
style -
Indicates the style of the notebook. It must
be either Simple or Spiral. Note that the Spiral style only allows tabs on
the Right and Bottom.
- Throws:
- IllegalArgumentException
This exception is thrown when any argument is not valid. It is also
thrown when the side and style arguments conflict (Top and Spiral are
conflicting values).
addPage
public void addPage (Object o, Component c, PageVerifier p)
- This method will add a component (usually an extension of Panel)
to the notebook with the given tab object. All pages must have a tab object
associated with them though multiple pages may share the same tab object.
Pages must be added in the appropriate order. If the tab object has already
been used, the page being added is added as part of the tab group with
that label. An object may be provided which will verify the page's
contents.
This overload sets the background and forground colrs for the tab to
light gray and black, respectively.
- Parameters:
o -
Gives the object to display as the tab for this page.
c -
Represents the visual item to use as this page.
v -
The object which will verify the page's contents.
This may be null.
addPage
public void addPage (Object o, Color bgc, Component c, PageVerifier p)
- This method will add a component (usually an extension of Panel)
to the notebook with the given tab object. All pages must have a tab object
associated with them though multiple pages may share the same tab object.
Pages must be added in the appropriate order. If the tab object has already
been used, the page being added is added as part of the tab group with
that label. An object may be provided which will verify the page's
contents.
This overload sets the background and forground colrs for the tab to
the color specified by the second argument and black, respectively.
- Parameters:
o -
Gives the object to display as the tab for this page.
bgc -
Gives the background color for the tab.
c -
Represents the visual item to use as this page.
v -
The object which will verify the page's contents.
This may be null.
addPage
public void addPage (Object o, Color bgc, Color fgc, Component c, PageVerifier p)
- This method will add a component (usually an extension of Panel)
to the notebook with the given tab object. All pages must have a tab object
associated with them though multiple pages may share the same tab object.
Pages must be added in the appropriate order. If the tab object has already
been used, the page being added is added as part of the tab group with
that label. An object may be provided which will verify the page's
contents.
This overload sets the background and forground colrs for the tab to
the colors specified by the second and third arguments, respectively.
- Parameters:
o -
Gives the object to display as the tab for this page.
bgc -
Gives the background color for the tab.
fgc -
Gives the forground color for the tab.
c -
Represents the visual item to use as this page.
v -
The object which will verify the page's contents.
This may be null.
pageShowing
public String pageShowing ()
- This method will return a String indicating the page of the
notebook which is currently on top. The String will have the format of
"tabname.#" where 'tabname' is the name of the tab associated with the
page, the '.' will be the Separator constant and '#' is the number
of the page within that tab. When the Notebook is using the Simple
style, # will always be 1 unless the page has been programatically set
otherwise.
- Returns:
- This method returns a String.
verifyPage
public void verifyPage ()
- This method will invoke the PageVerifier (if there is one) for
the currently visible notebook page.
turnToPage
public void turnToPage (Object tab, int page)
- This method will set the top page of the notebook to the component
indicated by the tab label object and tab page number given. The current page
is verified before the page is turned. If verification fails, the current page
is not changed to the requested page.
- Parameters:
tab -
Gives the tab identifying the group the desired page is
in. It must be a label previously associated with a page by addPage().
page -
Gives the page number within the tab group of the
desired page. It must be in the range of 1-n, where n is the
total number of pages in the tab group.
- Throws:
- IllegalArgumentException
This exception is thrown when any argument is not valid.
Events
The following table lists the relevant contents of an Event object and
under what circumstances the event is posted. All events are posted to
the owner of the notebook. The event.target attribute will always hold
a reference to the notebook.
Event.id |
Event.arg |
Event posting trigger |
ACTION_EVENT |
A String containing the new top page of the notebook. |
The user requested a new page either by using the scroll buttons or
by clicking on a tab. |
[
Previous section |
Next section |
This Package |
Package List |
Table of Contents
]