Class DataMatrix

java.lang.Object
java.awt.Component
java.awt.Canvas
com.idautomation.datamatrix.DataMatrix
All Implemented Interfaces:
ImageObserver, MenuContainer, Serializable, Accessible

public class DataMatrix extends Canvas implements Serializable
This is the main DataMatrix class that generates the DataMatrix barcode image.
See Also:
  • Field Details

  • Constructor Details

    • DataMatrix

      public DataMatrix()
  • Method Details

    • setDataToEncode

      public void setDataToEncode(String newCode)
      Sets the code property.
      Parameters:
      newCode - the new value for the code variable.
      See Also:
    • getDataToEncode

      public String getDataToEncode()
      Gets the code property.
      Returns:
      the current value of the code variable.
      See Also:
    • setMarginCM

      public void setMarginCM(double newMargin)
      Sets the marginCM property.
      Parameters:
      newMargin - the new value for the marginCM variable.
      See Also:
    • getMarginCM

      public double getMarginCM()
      Gets the marginCM property.
      Returns:
      the current value of the marginCM variable.
      See Also:
    • setTopMarginCM

      public void setTopMarginCM(double newMargin)
      Sets the topMarginCM property.
      Parameters:
      newMargin - the new value for the topMarginCM variable.
      See Also:
    • getTopMarginCM

      public double getTopMarginCM()
      Gets the topMarginCM property.
      Returns:
      the current value of the topMarginCM variable.
      See Also:
    • setLeftMarginCM

      public void setLeftMarginCM(double newMargin)
      Sets the leftMarginCM property.
      Parameters:
      newMargin - the new value for the leftMarginCM variable.
      See Also:
    • getLeftMarginCM

      public double getLeftMarginCM()
      Gets the leftMarginCM property.
      Returns:
      the current value of the leftMarginCM variable.
      See Also:
    • setBackground

      public void setBackground(Color newColor)
      Sets the backColor property.
      Overrides:
      setBackground in class Component
      Parameters:
      newColor - the new value for the backColor variable.
      See Also:
    • getBackground

      public Color getBackground()
      Gets the backColor property.
      Overrides:
      getBackground in class Component
      Returns:
      the current value of the backColor variable.
      See Also:
    • setPixelsPerCM

      public void setPixelsPerCM(int newRes)
      Sets the resolution property.
      Parameters:
      newRes - the new value for the resolution variable.
      See Also:
    • getPixelsPerCM

      public int getPixelsPerCM()
      Gets the resolution property.
      Returns:
      the current value of the resolution variable.
      See Also:
    • setXDimensionCM

      public void setXDimensionCM(double newX)
      Sets the X property.
      Parameters:
      newX - the new value for the X variable.
      See Also:
    • getXDimensionCM

      public double getXDimensionCM()
      Gets the X property.
      Returns:
      the current value of the X variable.
      See Also:
    • setAutoSize

      public void setAutoSize(boolean newVal)
      Sets the autoSize property.
      Parameters:
      newVal - the new value for the autoSize variable.
      See Also:
    • getAutoSize

      public boolean getAutoSize()
      Gets the autoSize property.
      Returns:
      the current value of the autoSize variable.
      See Also:
    • setImageSize

      public void setImageSize(int imgWidth, int imgHeight)
      Sets the size of the generated image, if used then autoSize is set to false.
      See Also:
    • getPreferredSize

      public Dimension getPreferredSize()
      Gets the size in pixels of the Preferred barcode image generated.
      Overrides:
      getPreferredSize in class Component
      Returns:
      Dimension(pWidth,pHeight)
      See Also:
    • getMinimumSize

      public Dimension getMinimumSize()
      Gets the minimum size in pixels of the barcode image generated.
      Overrides:
      getMinimumSize in class Component
      Returns:
      Dimension(8,8)
      See Also:
    • setForeground

      public void setForeground(Color newColor)
      Sets the barColor property.
      Overrides:
      setForeground in class Component
      Parameters:
      newColor - the new value for the barColor variable.
      See Also:
    • getForeground

      public Color getForeground()
      Gets the barColor property.
      Overrides:
      getForeground in class Component
      Returns:
      the current value of the barColor variable.
      See Also:
    • setRotationAngle

      public void setRotationAngle(int newRotate)
      Sets the rotate property.
      Parameters:
      newRotate - the new value for the rotate variable.
      See Also:
    • getRotationAngle

      public int getRotationAngle()
      Gets the rotate property.
      Returns:
      the current value of the rotate variable.
      See Also:
    • setProcessTilde

      public void setProcessTilde(boolean newVal)
      Sets the processTilde property.
      Parameters:
      newVal - the new value for the processTilde variable.
      See Also:
    • setShowHR

      public void setShowHR(boolean newVal)
      Sets the showHR property.
      Parameters:
      newVal - the new value for the showHR variable.
      See Also:
    • getShowHR

      public boolean getShowHR()
      Gets the showHR property value.
      Returns:
      the current value of the showHR variable.
      See Also:
    • setSingleLineHR

      public void setSingleLineHR(boolean newVal)
      Sets the setSingleLineHR property.
      Parameters:
      newVal - the new value for the setSingleLineHR variable.
      See Also:
    • getSingleLineHR

      public boolean getSingleLineHR()
      Gets the showHR property value.
      Returns:
      the current value of the SingleLineHR variable.
      See Also:
    • setFont

      public void setFont(Font newFont)
      Sets the textFont property.
      Overrides:
      setFont in class Component
      Parameters:
      newFont - the new value for the textFont variable.
      See Also:
    • getFont

      public Font getFont()
      Gets the textFont property value.
      Specified by:
      getFont in interface MenuContainer
      Overrides:
      getFont in class Component
      Returns:
      the current value of the textFont variable.
      See Also:
    • setTextFontColor

      public void setTextFontColor(Color newColor)
      Sets the fontColor property.
      Parameters:
      newColor - the new value for the fontColor variable.
      See Also:
    • getTextFontColor

      public Color getTextFontColor()
      Gets the fontColor property value.
      Returns:
      the current value of the fontColor variable.
      See Also:
    • getProcessTilde

      public boolean getProcessTilde()
      Gets the processTilde property.
      Returns:
      the current value of the processTilde variable.
      See Also:
    • setEncodingMode

      public void setEncodingMode(int newMode)
      Sets the encoding property.
      Parameters:
      newMode - the new value for the encoding variable.
      See Also:
    • getEncodingMode

      public int getEncodingMode()
      Gets the encoding property.
      Returns:
      the current value of the encoding variable.
      See Also:
    • setPreferredFormat

      public void setPreferredFormat(int newFormat)
      Sets the preferredFormat property.
      Parameters:
      newFormat - the new value for the preferredFormat variable.
      See Also:
    • getPreferredFormat

      public int getPreferredFormat()
      Gets the preferredFormat property.
      Returns:
      the current value of the preferredFormat variable.
      See Also:
    • createSVG

      public String createSVG()
    • createEPS

      public String createEPS()
    • paint

      public void paint(Graphics g2)
      Paints the barcode and rotates it if necessary
      Overrides:
      paint in class Canvas