CodabarBarcode (Barbecue 1.0.6d API)
Keywords: net.sourceforge.barbecue.linear.codabar.CodabarBarcode class

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## net.sourceforge.barbecue.linear.codabar
Class CodabarBarcode

    java.lang.Object
      java.awt.Component
          java.awt.Container
              javax.swing.JComponent
                  net.sourceforge.barbecue.Barcode
                      net.sourceforge.barbecue.linear.codabar.CodabarBarcode

All Implemented Interfaces:
  java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable

public class CodabarBarcode
extends Barcode

This is a concrete implementation of the Codabar barcode, AKA USD-4, Monarch, NW-7 and 2of7. This implementation imposes no restrictions on your choice of start and stop characters, so you will need to check that you are using chars acceptable to your barcode scanner. This implementation does support the traditional a, b, c, d, e, t, n and * start/stop chars. Omitting the start/stop chars from your data will cause the barcode to use the default start/stops chars, A and C, respectively.
This implementation provides no support for check digits (as they are not included in the Codabar specification). However, many uses of Codabars mandate the use of a check digit, and the algorithms used vary from application to application. The most common algorithm is Mod-16. If you wish to implement a check digit in your Codabar barcode, you must calculate it yourself and insert it into the data to be encoded before the Stop char (or at the end of the data if you are letting barbecue insert start and stop chars for you).

Author:
  Ian Bourke
See Also:
  Serialized Form

Nested Class Summary

Nested classes inherited from class javax.swing.JComponent
`javax.swing.JComponent.AccessibleJComponent`

Nested classes inherited from class java.awt.Container
`java.awt.Container.AccessibleAWTContainer`

Nested classes inherited from class java.awt.Component
`java.awt.Component.AccessibleAWTComponent, java.awt.Component.BltBufferStrategy, java.awt.Component.FlipBufferStrategy`

Field Summary
`static java.lang.String` | `DEFAULT_START` The default codabar start character
`static java.lang.String` | `DEFAULT_STOP` The default codabar stop character

Fields inherited from class net.sourceforge.barbecue.Barcode
`barHeight, barWidth, data, drawingText`

Fields inherited from class javax.swing.JComponent
`accessibleContext, listenerList, TOOL_TIP_TEXT_KEY, ui, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOW`

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
`CodabarBarcode(java.lang.String data)` Constructs a new Codabar barcode with thte specified data.

Method Summary
`protected Module` | `calculateChecksum()` Calculates the check sum digit for the barcode.
`protected Module[]` | `encodeData()` Encodes the data of the barcode into bars.
`protected double` | `getBarcodeWidth(int resolution)` Returns the total width of the barcode in pixels at the given resolution.
`protected java.lang.String` | `getLabel()` Returns the text label to be displayed underneath the barcode.
`protected Module` | `getPostAmble()` Returns the post-amble for the barcode.
`protected Module` | `getPreAmble()` Returns the pre-amble for the barcode.

Methods inherited from class net.sourceforge.barbecue.Barcode
`beautify, calculateMinimumBarHeight, draw, drawModule, getBounds, getBounds, getData, getHeight, getMaximumSize, getMinimumSize, getPreferredSize, getResolution, getSize, getSVG, getWidth, getX, getY, isDrawingText, outputSVG, paintComponent, setBarHeight, setBarWidth, setDrawingText, setFont, setResolution, setSVGScalar`

Methods inherited from class javax.swing.JComponent
`addAncestorListener, addNotify, addPropertyChangeListener, addPropertyChangeListener, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, fireVetoableChange, getAccessibleContext, getActionForKeyStroke, getActionMap, getAlignmentX, getAlignmentY, getAncestorListeners, getAutoscrolls, getBorder, getClientProperty, getComponentGraphics, getConditionForKeyStroke, getDebugGraphicsOptions, getDefaultLocale, getGraphics, getInputMap, getInputMap, getInputVerifier, getInsets, getInsets, getListeners, getLocation, getNextFocusableComponent, getPropertyChangeListeners, getPropertyChangeListeners, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getToolTipText, getTopLevelAncestor, getTransferHandler, getUIClassID, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, grabFocus, isDoubleBuffered, isLightweightComponent, isManagingFocus, isMaximumSizeSet, isMinimumSizeSet, isOpaque, isOptimizedDrawingEnabled, isPaintingTile, isPreferredSizeSet, isRequestFocusEnabled, isValidateRoot, paint, paintBorder, paintChildren, paintImmediately, paintImmediately, paramString, print, printAll, printBorder, printChildren, printComponent, processComponentKeyEvent, processKeyBinding, processKeyEvent, processMouseMotionEvent, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeNotify, removePropertyChangeListener, removePropertyChangeListener, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resetKeyboardActions, reshape, revalidate, scrollRectToVisible, setActionMap, setAlignmentX, setAlignmentY, setAutoscrolls, setBackground, setBorder, setDebugGraphicsOptions, setDefaultLocale, setDoubleBuffered, setEnabled, setForeground, setInputMap, setInputVerifier, setMaximumSize, setMinimumSize, setNextFocusableComponent, setOpaque, setPreferredSize, setRequestFocusEnabled, setToolTipText, setTransferHandler, setUI, setVerifyInputWhenFocusTarget, setVisible, unregisterKeyboardAction, update, updateUI`

Methods inherited from class java.awt.Container
`add, add, add, add, add, addContainerListener, addImpl, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getContainerListeners, getFocusTraversalKeys, getFocusTraversalPolicy, getLayout, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusCycleRoot, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, printComponents, processContainerEvent, processEvent, remove, remove, removeAll, removeContainerListener, setFocusCycleRoot, setFocusTraversalKeys, setFocusTraversalPolicy, setLayout, transferFocusBackward, transferFocusDownCycle, validate, validateTree`

Methods inherited from class java.awt.Component
`action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, coalesceEvents, contains, createImage, createImage, createVolatileImage, createVolatileImage, disableEvents, dispatchEvent, enable, enableEvents, enableInputMethods, getBackground, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, getGraphicsConfiguration, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocale, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMouseWheelListeners, getName, getParent, getPeer, getToolkit, getTreeLock, gotFocus, handleEvent, hasFocus, hide, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isShowing, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, postEvent, prepareImage, prepareImage, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processMouseEvent, processMouseWheelEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, repaint, repaint, repaint, resize, resize, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setFocusable, setFocusTraversalKeysEnabled, setIgnoreRepaint, setLocale, setLocation, setLocation, setName, setSize, setSize, show, show, size, toString, transferFocus, transferFocusUpCycle`

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

Field Detail

### DEFAULT_START

    public static final java.lang.String DEFAULT_START

  The default codabar start character

  See Also:
    Constant Field Values

### DEFAULT_STOP

    public static final java.lang.String DEFAULT_STOP

  The default codabar stop character

  See Also:
    Constant Field Values

Constructor Detail

### CodabarBarcode

    public CodabarBarcode(java.lang.String data)
                   throws BarcodeException

  Constructs a new Codabar barcode with thte specified data.

Parameters:
  `data` - The data to encode
Throws:
  `BarcodeException` - If the data is invalid

Method Detail

### getLabel

    protected java.lang.String getLabel()

  Returns the text label to be displayed underneath the barcode.

  Overrides:
    `getLabel` in class `Barcode`
  Returns:
    The barcode label

### getBarcodeWidth

    protected double getBarcodeWidth(int resolution)

  Returns the total width of the barcode in pixels at the given resolution.

  Specified by:
    `getBarcodeWidth` in class `Barcode`
  Parameters:
    `resolution` - The resolution to calculate the width for
  Returns:
    The width of the barcode in pixels

### encodeData

    protected Module[] encodeData()

  Encodes the data of the barcode into bars.

  Specified by:
    `encodeData` in class `Barcode`
  Returns:
    The encoded bar data

### calculateChecksum

    protected Module calculateChecksum()

  Calculates the check sum digit for the barcode.

  Specified by:
    `calculateChecksum` in class `Barcode`
  Returns:
    Null - Codabar has no checksum

### getPreAmble

    protected Module getPreAmble()

  Returns the pre-amble for the barcode.

  Specified by:
    `getPreAmble` in class `Barcode`
  Returns:
    A BlankModule

### getPostAmble

    protected Module getPostAmble()

  Returns the post-amble for the barcode.

  Specified by:
    `getPostAmble` in class `Barcode`
  Returns:
    A BlankModule

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD