Last Updated: 3/4/97
Class NFRegion

Class NFRegion

public class NFRegion extends Canvas

Creates a rectangular region, with or without a border.

Within an HTML file, the following parameters (as supported by NFParam) can be used to specify the attributes of a label:

 	Color		- Color of region. See NFColor for values.

 	BorderType	- Any of the following keywords:
 				NONE	- No border
 				BOX	- Box outline
 				SHADOW	- Shadow border (default)
 				RAISED	- Raised border
 				RECESS	- Recessed border

 	BorderWidth	- Numeric border width (in pixels) (default 4)

 	Image		- URL for image file to be used as background

Final Variables

Type Name Description
int BOX Box border
int NONE No border
int RAISED Raised border
int RECESS Recessed border
int SHADOW Shadow border
int SIZE size image to fit area
int TILE tile image in area

Constructors

Methods


NFRegion ()
Create a new region, using all defaults.

NFRegion (Graphics g)
Create a new region, using default attributes and position.

NFRegion (Graphics g,
          int x,
          int y,
          int width,
          int height)
Create a new region, using default attributes.

NFRegion (Graphics g,
          int x,
          int y,
          int width,
          int height,
          Color color,
          int borderType,
          int borderWidth,
          Color borderColor)
Create a new region, specifying all attributes.

static NFParamDef defineBorderType (NFParam p,
                                    String param,
                                    int type)
Create a parser definition for border type and assign the given type as the default.

static NFParamDef defineImageType (NFParam p,
                                   String param,
                                   int type)
Create a parser definition for image type and assign the given type as the default.

static NFParamDef defineRegion (NFParam p,
                                String param)
Create a parser definition for a background region.

static int defineRegion (NFParam p,
                         String param,
                         Vector v)
Append the parameters needed for a region to the given vector. This method returns the number of parameters appended.

void draw ()
Draw a region using the current attributes.

void draw (Graphics g)
Draw a region in the given graphics context, using the current attributes.

void draw (Graphics g,
           int x,
           int y)
Draw a region at the given location, using the current attributes.

void draw (Graphics g,
           int x,
           int y,
           int width,
           int height)
Draw a region at the given location and size, using the current attributes.

void draw (Graphics g,
           int x,
           int y,
           int width,
           int height,
           Color color,
           int borderType,
           int borderWidth,
           Color borderColor,
           Image im)
Draw a region at the given location and size, using the current attributes.

synchronized static void draw (Graphics g,
                               int x,
                               int y,
                               int width,
                               int height,
                               Color color,
                               int borderType,
                               int borderWidth,
                               Color borderColor,
                               Image im,
                               int imageType) 
Draw a region given all of the attributes.

NFRegionBorder getBorder ()
Get the amount of space used by the border on all four sides of the region, based on the current border style and width.
The NFRegionBorder class is defined as follows:
 	int left;
 	int right;
 	int top;
 	int bottom;

static NFRegionBorder getBorder (int borderType,
                                 int borderWidth)
Get the amount of space used by the border on all four sides of the region, based on the given border style and width.
The NFRegionBorder class is defined as follows:
 	int left;
 	int right;
 	int top;
 	int bottom;

Color getBorderColor ()
Get the border attribute.

int getBorderType ()
Returns the current border type

Color getColor ()
Get the color.

static NFRegion loadParams (NFParam p,
                            Object val)
Build a new region, given a vector of values from the parser.

static NFRegion loadParams (NFParam p,
                            Object val,
                            int offset)
Build a new region, given a vector of values from the parser, starting at the given offset.

void setBorder (int type)
Set the border type;

void setBorder (int type,
                int width,
                Color color)
Set the border attributes.

void setBorderColor (Color color)
Set the border attributes.

void setBorderType (int type)
Set the border attributes.

void setBorderWidth (int width)
Set the border attributes.

void setColor (Color color)
Set the color.

void setGraphics (Graphics g)
Set the graphics context.

void setImage (Image im)
Set the background image.

void setImageType (int type)
Set the border attributes.

void setPos (int x,
             int y)
Set the upper left position for the region.

void setSize (int width,
              int height)
Set the size of the region.