Class BarCode3of9

Class BarCode3of9

java.lang.Object
   |
   +----java.awt.Component
           |
           +----java.awt.Canvas
                   |
                   +----BarCode3of9

public class BarCode3of9
extends Canvas
A class that produces a Barcode component.
Version:
1.00 97/Nov
Author:
Umberto Marzo, umarzo@eniware.it

Variable Index

o BASELINE
Costant for text alignment.
o CODE3OF9
Costant for variant of the code.
o CODE3OF9CHK
Costant for variant of the code.
o LARGE
Costant for size of the narrowest bar.
o MEDIUM
Costant for size of the narrowest bar.
o MIDDLELINE
Costant for text alignment.
o SMALL
Costant for size of the narrowest bar.
o TOPLINE
Costant for text alignment.

Constructor Index

o BarCode3of9()
Constructs a Barcode object with an empty string and the following defaults:
size 100x50;
label inside;
small rendering;
black on white color;
Courier,12 font;

Method Index

o getBackground()
return the color used for the background.
o getDimension()
Gets the dimension of the narrowest bar.
o getFont()
Gets the font of the component.
o getForeground()
return the color used for the foreground.
o getMinimumSize()
Returns the mininimum size of this component.
o getPreferredSize()
Returns the preferred size of this component.
o getString()
Gets the string encoded in the Barcode.
o getStyle()
return the style of the barcode currently used.
o getTextAlign()
Set the alignment of text inside the bar code.
o isTextInside()
Return true if a label will be shown inside.
o minimumSize()
Returns the minimum size of this component.
o paint(Graphics)
Paints the component.
o paramString()
Returns the parameter String of this Component.
o preferredSize()
o requestedMinimunSize(String)
Return the minimum dimension needed to successfully display a code of string str.
o resize(Dimension)
Resizes the Component to the specified dimension.
o resize(int, int)
Resizes the Component to the specified width and height.
o setBackground(Color)
set the color of the background to the specified color.
o setDimension(int)
Sets the dimension of the narrowest bar.
o setFont(Font)
Sets the font of the component.
o setForeground(Color)
set the color of the foreground to the specified color.
o setString(String)
Sets the string encoded in the Barcode.
o setStyle(int)
Set the style of the code to one of the two available style.
o setTextAlign(int)
Set the alignment of text inside the bar code.
o setTextInside(boolean)
Call this method with true (or false) as argument if you want (or not) a text label inside.
o toString()
Returns the String representation of this Component's values.

Variables

o CODE3OF9
  public final static int CODE3OF9
Costant for variant of the code.
See Also:
CODE3OF9CHK, CODE3OF9, setStyle, getStyle
o CODE3OF9CHK
  public final static int CODE3OF9CHK
Costant for variant of the code.
See Also:
CODE3OF9CHK, CODE3OF9, setStyle, getStyle
o SMALL
  public final static int SMALL
Costant for size of the narrowest bar.
See Also:
SMALL, MEDIUM, LARGE, setDimension, getDimension
o MEDIUM
  public final static int MEDIUM
Costant for size of the narrowest bar.
See Also:
SMALL, MEDIUM, LARGE, setDimension, getDimension
o LARGE
  public final static int LARGE
Costant for size of the narrowest bar.
See Also:
SMALL, MEDIUM, LARGE, setDimension, getDimension
o BASELINE
  public final static int BASELINE
Costant for text alignment.
See Also:
BASELINE, MIDDLELINE, TOPLINE, setTextAlign, getTextAlign
o MIDDLELINE
  public final static int MIDDLELINE
Costant for text alignment.
See Also:
BASELINE, MIDDLELINE, TOPLINE, setTextAlign, getTextAlign
o TOPLINE
  public final static int TOPLINE
Costant for text alignment.
See Also:
BASELINE, MIDDLELINE, TOPLINE, setTextAlign, getTextAlign

Constructors

o BarCode3of9
  public BarCode3of9()
Constructs a Barcode object with an empty string and the following defaults:
size 100x50;
label inside;
small rendering;
black on white color;
Courier,12 font;

Methods

o getMinimumSize
  public Dimension getMinimumSize()
Returns the mininimum size of this component.
See Also:
getPreferredSize
o minimumSize
  public Dimension minimumSize()
Returns the minimum size of this component.
Overrides:
minimumSize in class Component
See Also:
preferredSize
o getPreferredSize
  public Dimension getPreferredSize()
Returns the preferred size of this component.
See Also:
getMinimumSize
o preferredSize
  public Dimension preferredSize()
Overrides:
preferredSize in class Component
o resize
  public void resize(int width,
                     int height)
Resizes the Component to the specified width and height.
Parameters:
width - the width of the component
height - the height of the component
Overrides:
resize in class Component
o resize
  public void resize(Dimension d)
Resizes the Component to the specified dimension.
Parameters:
d - the dimension of the component
Overrides:
resize in class Component
o paramString
  protected String paramString()
Returns the parameter String of this Component.
Overrides:
paramString in class Component
o toString
  public String toString()
Returns the String representation of this Component's values.
Overrides:
toString in class Component
o requestedMinimunSize
  public Dimension requestedMinimunSize(String str)
Return the minimum dimension needed to successfully display a code of string str. Use it to resize the component using method resize(Dimension d)
Parameters:
str - the sting to encode
Returns:
the minimum dimension
o setString
  public void setString(String str) throws IllegalArgumentException
Sets the string encoded in the Barcode.
Parameters:
str - the string to encode
Throws: IllegalArgumentException
If an improper string was given.
See Also:
getString
o getString
  public String getString()
Gets the string encoded in the Barcode.
Returns:
the encoded string
See Also:
setString
o setDimension
  public void setDimension(int dim)
Sets the dimension of the narrowest bar. Values allowed are SMALL, MEDIUM and LARGE
Parameters:
dim - the dimension
See Also:
SMALL, MEDIUM, LARGE, getDimension
o getDimension
  public int getDimension()
Gets the dimension of the narrowest bar.
Returns:
the dim of the bar
See Also:
SMALL, MEDIUM, LARGE, setDimension
o setTextInside
  public void setTextInside(boolean bool)
Call this method with true (or false) as argument if you want (or not) a text label inside.
See Also:
isTextInside
o isTextInside
  public boolean isTextInside()
Return true if a label will be shown inside.
See Also:
setTextInside
o setStyle
  public void setStyle(int styl)
Set the style of the code to one of the two available style.
See Also:
CODE3OF9, CODE3OF9CHK, getStyle
o getStyle
  public int getStyle()
return the style of the barcode currently used.
See Also:
CODE3OF9, CODE3OF9CHK, setStyle
o setBackground
  public void setBackground(Color c)
set the color of the background to the specified color.
Parameters:
c - the color to be used
Overrides:
setBackground in class Component
See Also:
getBackgroundColor, setForegroundColor, getForegroundColor
o getBackground
  public Color getBackground()
return the color used for the background.
Returns:
the color used
Overrides:
getBackground in class Component
See Also:
setBackgroundColor, setForegroundColor, getForegroundColor
o setForeground
  public void setForeground(Color c)
set the color of the foreground to the specified color.
Parameters:
c - the color to be used
Overrides:
setForeground in class Component
See Also:
getBackgroundColor, setBackgroundColor, getForegroundColor
o getForeground
  public Color getForeground()
return the color used for the foreground.
Returns:
the color used
Overrides:
getForeground in class Component
See Also:
setBackgroundColor, getBackgroundColor, setForegroundColor
o setFont
  public void setFont(Font fnt)
Sets the font of the component.
Parameters:
fnt - the font
Overrides:
setFont in class Component
See Also:
getFont
o getFont
  public Font getFont()
Gets the font of the component.
Overrides:
getFont in class Component
See Also:
setFont
o setTextAlign
  public void setTextAlign(int align)
Set the alignment of text inside the bar code. Three option are available.
See Also:
BASELINE, MIDDLELINE, TOPLINE, getTextAlign
o getTextAlign
  public int getTextAlign()
Set the alignment of text inside the bar code. Three option are available.
See Also:
BASELINE, MIDDLELINE, TOPLINE, setTextAlign
o paint
  public synchronized void paint(Graphics g)
Paints the component.
Parameters:
g - the specified Graphics window
Overrides:
paint in class Canvas