本文整理汇总了Java中net.sourceforge.barbecue.BarcodeFactory.createCode128A方法的典型用法代码示例。如果您正苦于以下问题:Java BarcodeFactory.createCode128A方法的具体用法?Java BarcodeFactory.createCode128A怎么用?Java BarcodeFactory.createCode128A使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类net.sourceforge.barbecue.BarcodeFactory
的用法示例。
在下文中一共展示了BarcodeFactory.createCode128A方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: drawingBarcodeDirectToGraphics
import net.sourceforge.barbecue.BarcodeFactory; //导入方法依赖的package包/类
public static void drawingBarcodeDirectToGraphics()
throws BarcodeException, OutputException {
// Always get a Barcode from the BarcodeFactory
Barcode barcode = BarcodeFactory.createCode128A("My Barcode");
// We are created an image from scratch here, but for printing in Java,
// your print renderer should have a Graphics internally anyway
BufferedImage image = new BufferedImage(500, 500,
BufferedImage.TYPE_BYTE_GRAY);
// We need to cast the Graphics from the Image to a Graphics2D:
// this is OK
Graphics2D g = (Graphics2D) image.getGraphics();
// Barcode supports a direct draw method to Graphics2D that lets you
// position the barcode on the canvas
barcode.draw(g, 10, 56);
}
示例2: outputtingBarcodeAsPNG
import net.sourceforge.barbecue.BarcodeFactory; //导入方法依赖的package包/类
public static void outputtingBarcodeAsPNG() throws BarcodeException,
IOException, OutputException {
// get a Barcode from the BarcodeFactory
Barcode barcode = BarcodeFactory.createCode128A("My Barcode");
File f = new File("mybarcode.png");
// Let the barcode image handler do the hard work
BarcodeImageHandler.savePNG(barcode, f);
}
示例3: usingBarbecueAsSwingComponent
import net.sourceforge.barbecue.BarcodeFactory; //导入方法依赖的package包/类
public static void usingBarbecueAsSwingComponent() throws BarcodeException {
JPanel panel = new JPanel();
// Always get a Barcode from the BarcodeFactory
Barcode barcode = BarcodeFactory.createCode128A("My Barcode");
/*
* Because Barcode extends Component, you can use it just like any other
* Swing component. In this case, we can add it straight into a panel
* and it will be drawn and layed out according to the layout of the
* panel.
*/
panel.add(barcode);
}
示例4: createBaseBarcode
import net.sourceforge.barbecue.BarcodeFactory; //导入方法依赖的package包/类
@Override
protected Barcode createBaseBarcode(BarcodeInfo barcodeInfo)
throws BarcodeException
{
return BarcodeFactory.createCode128A(barcodeInfo.getCode());
}