com.java4less.onecode
Class OneCode

java.lang.Object
  |
  +--java.awt.Component
        |
        +--java.awt.Canvas
              |
              +--com.java4less.onecode.OneCode
All Implemented Interfaces:
javax.accessibility.Accessible, java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable

public class OneCode
extends java.awt.Canvas

This class creates OneCode symbols. Since it is a subclass of java.awt.Canvas it can be added to any Java container.

OneCode barcode=new OneCode();
barcode.setRoutingCode("");
barcode.setBarcodeIdentifier(01);
barcode.setSpecialServices(234);
barcode.setCustomerIdentifier(567094);
barcode.setSequenceNumber(987654321);
barcode.setSize(300,300);
ImageEncoder be= new ImageEncoder(barcode,"JPEG","barcode.jpg");


If you want to create gif or png files you will need to download the encoders:
- gif encoder from http://www.acme.com/resources/classes/Acme.tar.gz
- png encoder http://209.51.137.74/pngencoder-1.0.jar


The barcode can also be painted in a external graphic context, for example an image:

java.awt.image.BufferedImage im=new java.awt.image.BufferedImage(barcode.getWidth(),barcode.getHeight(),java.awt.image.BufferedImage.TYPE_INT_RGB);
Graphics g2=im.createGraphics();
barcode.paint(g2);

See Also:
Serialized Form

Field Summary
 
Fields inherited from class java.awt.Component
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
 
Fields inherited from interface java.awt.image.ImageObserver
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
 
Constructor Summary
OneCode()
           
 
Method Summary
 java.awt.Color getBackColor()
          background color.
 int getBarcodeIdentifier()
          barcode Identifier (2 digits, second digit must be 0-4)
 java.awt.Color getBarColor()
          color of the bars.
 int getBarHeight()
          length of bars without ascender and descender
 int getBarSpacing()
          space between bars
 int getBarWidth()
          size (width) of the bars (module).
 int getCurrentX()
          get last X possition.
 int getCurrentY()
          get last Y possition.
 int getCustomerIdentifier()
          customer Identifier (6 digits)
 int getExtendedBarHeight()
          height of full bar with ascender and descender
 java.awt.Color getFontColor()
          font color for user text
 int getLeftMargin()
          left margin of the barcode (also know as quite zone).
 java.lang.String getName()
          Returns "OneCode".
 int getQuiteZone()
          distance between bars and text
 boolean getRedraw()
          Redraw symbol
 java.lang.String getRoutingCode()
          routing code 0, 5, 9 or 11 digits
 int getSequenceNumber()
          sequence number ( 9 digits )
 int getSpecialServices()
          Special Services (3 digits)
 java.awt.Font getTextFont()
          font for user text
 int getTopMargin()
          top margin of the barcode (also know as quite zone).
 java.lang.String[] getUserTextBottom()
          user text be displayed below the barcode
 java.lang.String[] getUserTextTop()
          user text be displayed over the barcode
 void paint(java.awt.Graphics g)
          paints the symbol.
 void setBackColor(java.awt.Color c)
          background color.
 void setBarcodeIdentifier(int i)
          barcode Identifier (2 digits, second digit must be 0-4)
 void setBarColor(java.awt.Color c)
          color of the bars.
 void setBarHeight(int b)
          length of bars without ascender and descender
 void setBarSpacing(int d)
          space between bars
 void setBarWidth(int d)
          size (width) of the bars (module).
 void setCustomerIdentifier(int i)
          customer Identifier (6 digits)
 void setExtendedBarHeight(int b)
          height of full bar with ascender and descender
 void setFontColor(java.awt.Color c)
          font color for user text
 void setLeftMargin(int d)
          left margin of the barcode (also know as quite zone).
 void setQuiteZone(int b)
          distance between bars and text
 void setRedraw(boolean b)
          Redraw symbol.
 void setRoutingCode(java.lang.String s)
          routing code 0, 5, 9 or 11 digits
 void setSequenceNumber(int n)
          sequence number ( 9 digits )
 void setSpecialServices(int i)
          Special Services (3 digits)
 void setTextFont(java.awt.Font f)
          font for user text
 void setTopMargin(int d)
          top margin of the barcode (also know as quite zone).
 void setUserTextBottom(java.lang.String[] t)
          user text be displayed below the barcode
 void setUserTextTop(java.lang.String[] t)
          user text be displayed over the barcode
 
Methods inherited from class java.awt.Canvas
addNotify, createBufferStrategy, createBufferStrategy, getAccessibleContext, getBufferStrategy, update
 
Methods inherited from class java.awt.Component
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, addPropertyChangeListener, addPropertyChangeListener, applyComponentOrientation, areFocusTraversalKeysSet, bounds, checkImage, checkImage, contains, contains, createImage, createImage, createVolatileImage, createVolatileImage, deliverEvent, disable, dispatchEvent, doLayout, enable, enable, enableInputMethods, getAlignmentX, getAlignmentY, getBackground, getBounds, getBounds, getColorModel, getComponentAt, getComponentAt, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeys, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, getGraphics, getGraphicsConfiguration, getHeight, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getListeners, getLocale, getLocation, getLocation, getLocationOnScreen, getMaximumSize, getMinimumSize, getMouseListeners, getMouseMotionListeners, getMouseWheelListeners, getParent, getPeer, getPreferredSize, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getSize, getToolkit, getTreeLock, getWidth, getX, getY, gotFocus, handleEvent, hasFocus, hide, imageUpdate, inside, invalidate, isBackgroundSet, isCursorSet, isDisplayable, isDoubleBuffered, isEnabled, isFocusable, isFocusCycleRoot, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isOpaque, isShowing, isValid, isVisible, keyDown, keyUp, layout, list, list, list, list, list, locate, location, lostFocus, minimumSize, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, postEvent, preferredSize, prepareImage, prepareImage, print, printAll, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removeNotify, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, repaint, requestFocus, requestFocusInWindow, reshape, resize, resize, setBackground, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setEnabled, setFocusable, setFocusTraversalKeys, setFocusTraversalKeysEnabled, setFont, setForeground, setIgnoreRepaint, setLocale, setLocation, setLocation, setName, setSize, setSize, setVisible, show, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCycle, validate
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

OneCode

public OneCode()
Method Detail

getFontColor

public java.awt.Color getFontColor()
font color for user text

Returns:

setFontColor

public void setFontColor(java.awt.Color c)
font color for user text

Returns:

getTextFont

public java.awt.Font getTextFont()
font for user text

Returns:

setTextFont

public void setTextFont(java.awt.Font f)
font for user text

Returns:

getSpecialServices

public int getSpecialServices()
Special Services (3 digits)

Returns:

setSpecialServices

public void setSpecialServices(int i)
Special Services (3 digits)


getBarcodeIdentifier

public int getBarcodeIdentifier()
barcode Identifier (2 digits, second digit must be 0-4)

Returns:

setBarcodeIdentifier

public void setBarcodeIdentifier(int i)
barcode Identifier (2 digits, second digit must be 0-4)


getCustomerIdentifier

public int getCustomerIdentifier()
customer Identifier (6 digits)

Returns:

setCustomerIdentifier

public void setCustomerIdentifier(int i)
customer Identifier (6 digits)


getSequenceNumber

public int getSequenceNumber()
sequence number ( 9 digits )

Returns:

setSequenceNumber

public void setSequenceNumber(int n)
sequence number ( 9 digits )

Parameters:
n -

getRoutingCode

public java.lang.String getRoutingCode()
routing code 0, 5, 9 or 11 digits

Returns:

setRoutingCode

public void setRoutingCode(java.lang.String s)
routing code 0, 5, 9 or 11 digits


getLeftMargin

public int getLeftMargin()
left margin of the barcode (also know as quite zone). The default is 20 pixels.


setLeftMargin

public void setLeftMargin(int d)
left margin of the barcode (also know as quite zone). The default is 20 pixels.


getTopMargin

public int getTopMargin()
top margin of the barcode (also know as quite zone). The default is 20 pixels.


setTopMargin

public void setTopMargin(int d)
top margin of the barcode (also know as quite zone). The default is 20 pixels.


getRedraw

public boolean getRedraw()
Redraw symbol


setRedraw

public void setRedraw(boolean b)
Redraw symbol. Set this property to true if you change any property of the barcode and you want to rebuild it.


getBackColor

public java.awt.Color getBackColor()
background color.


setBackColor

public void setBackColor(java.awt.Color c)
background color.


getBarColor

public java.awt.Color getBarColor()
color of the bars.


setBarColor

public void setBarColor(java.awt.Color c)
color of the bars.


getBarSpacing

public int getBarSpacing()
space between bars


setBarSpacing

public void setBarSpacing(int d)
space between bars


getBarHeight

public int getBarHeight()
length of bars without ascender and descender


setBarHeight

public void setBarHeight(int b)
length of bars without ascender and descender


getExtendedBarHeight

public int getExtendedBarHeight()
height of full bar with ascender and descender


setExtendedBarHeight

public void setExtendedBarHeight(int b)
height of full bar with ascender and descender


getQuiteZone

public int getQuiteZone()
distance between bars and text


setQuiteZone

public void setQuiteZone(int b)
distance between bars and text


getUserTextTop

public java.lang.String[] getUserTextTop()
user text be displayed over the barcode


setUserTextTop

public void setUserTextTop(java.lang.String[] t)
user text be displayed over the barcode


getUserTextBottom

public java.lang.String[] getUserTextBottom()
user text be displayed below the barcode


setUserTextBottom

public void setUserTextBottom(java.lang.String[] t)
user text be displayed below the barcode


getName

public java.lang.String getName()
Returns "OneCode".

Overrides:
getName in class java.awt.Component

getBarWidth

public int getBarWidth()
size (width) of the bars (module).


setBarWidth

public void setBarWidth(int d)
size (width) of the bars (module).


paint

public void paint(java.awt.Graphics g)
paints the symbol.

Overrides:
paint in class java.awt.Canvas

getCurrentX

public int getCurrentX()
get last X possition. Use this property to find out the size in pixels of the barcode.


getCurrentY

public int getCurrentY()
get last Y possition. Use this property to find out the size in pixels of the barcode.