当前位置: 首页>>代码示例>>Java>>正文


Java BarcodeFactory类代码示例

本文整理汇总了Java中net.sourceforge.barbecue.BarcodeFactory的典型用法代码示例。如果您正苦于以下问题:Java BarcodeFactory类的具体用法?Java BarcodeFactory怎么用?Java BarcodeFactory使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


BarcodeFactory类属于net.sourceforge.barbecue包,在下文中一共展示了BarcodeFactory类的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: DynamicImageController

import net.sourceforge.barbecue.BarcodeFactory; //导入依赖的package包/类
public DynamicImageController() {
       try {
           //Graphic Text
           BufferedImage bufferedImg = new BufferedImage(100, 25, BufferedImage.TYPE_INT_RGB);
           Graphics2D g2 = bufferedImg.createGraphics();
           g2.drawString("This is a text", 0, 10);
           ByteArrayOutputStream os = new ByteArrayOutputStream();
           ImageIO.write(bufferedImg, "png", os);
           graphicText = new DefaultStreamedContent(new ByteArrayInputStream(os.toByteArray()), "image/png"); 

           //Chart
           JFreeChart jfreechart = ChartFactory.createPieChart("Turkish Cities", createDataset(), true, true, false);
           File chartFile = new File("dynamichart");
           ChartUtilities.saveChartAsPNG(chartFile, jfreechart, 375, 300);
           chart = new DefaultStreamedContent(new FileInputStream(chartFile), "image/png");

           //Barcode
		File barcodeFile = new File("dynamicbarcode");
		BarcodeImageHandler.saveJPEG(BarcodeFactory.createCode128("PRIMEFACES"), barcodeFile);
		barcode = new DefaultStreamedContent(new FileInputStream(barcodeFile), "image/jpeg");
	} catch (Exception e) {
		e.printStackTrace();
	}
}
 
开发者ID:websphere,项目名称:PrimefacesShowcase,代码行数:25,代码来源:DynamicImageController.java

示例2: 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);
}
 
开发者ID:nakomis,项目名称:barbecue,代码行数:18,代码来源:FormatExample.java

示例3: 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);
}
 
开发者ID:nakomis,项目名称:barbecue,代码行数:9,代码来源:FormatExample.java

示例4: createBaseBarcode

import net.sourceforge.barbecue.BarcodeFactory; //导入依赖的package包/类
@Override
protected Barcode createBaseBarcode(BarcodeInfo barcodeInfo)
		throws BarcodeException
{
	return BarcodeFactory.create3of9(barcodeInfo.getCode(), 
			barcodeInfo.getRequiresChecksum());
}
 
开发者ID:TIBCOSoftware,项目名称:jasperreports,代码行数:8,代码来源:BarcodeProviders.java

示例5: outputtingBarcode128x1

import net.sourceforge.barbecue.BarcodeFactory; //导入依赖的package包/类
public static void outputtingBarcode128x1() throws BarcodeException,
        IOException, OutputException {
    Barcode barcode3;
    barcode3 = BarcodeFactory.createCode128("CODE128x1");
    barcode3.setResolution(300);
    BarcodeImageHandler.savePNG(barcode3, new File("Code128-1.png"));
}
 
开发者ID:nakomis,项目名称:barbecue,代码行数:8,代码来源:ExampleCode128.java

示例6: outputtingBarcode128x2

import net.sourceforge.barbecue.BarcodeFactory; //导入依赖的package包/类
public static void outputtingBarcode128x2() throws BarcodeException,
        IOException, OutputException {
    Barcode barcode3;
    barcode3 = BarcodeFactory.createCode128("2HgH328355316700000241500100");
    barcode3.setResolution(300);
    BarcodeImageHandler.savePNG(barcode3, new File("Code128-2.png"));
}
 
开发者ID:nakomis,项目名称:barbecue,代码行数:8,代码来源:ExampleCode128.java

示例7: outputtingBarcode128x3

import net.sourceforge.barbecue.BarcodeFactory; //导入依赖的package包/类
public static void outputtingBarcode128x3() throws BarcodeException,
        IOException, OutputException {
    Barcode barcode3;
    barcode3 = BarcodeFactory.createCode128("Code128-3");
    barcode3.setResolution(300);
    BarcodeImageHandler.savePNG(barcode3, new File("Code128-3.png"));
}
 
开发者ID:nakomis,项目名称:barbecue,代码行数:8,代码来源:ExampleCode128.java

示例8: outputtingBarcode128x4

import net.sourceforge.barbecue.BarcodeFactory; //导入依赖的package包/类
public static void outputtingBarcode128x4() throws BarcodeException,
        IOException, OutputException {
    Barcode barcode3;
    barcode3 = BarcodeFactory
            .createCode128("314159265358979323846264338327950288");
    barcode3.setResolution(300);
    BarcodeImageHandler.savePNG(barcode3, new File("Code128-4.png"));
}
 
开发者ID:nakomis,项目名称:barbecue,代码行数:9,代码来源:ExampleCode128.java

示例9: 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);
}
 
开发者ID:nakomis,项目名称:barbecue,代码行数:15,代码来源:FormatExample.java

示例10: outputtingBarcodeAsJPEG

import net.sourceforge.barbecue.BarcodeFactory; //导入依赖的package包/类
public static void outputtingBarcodeAsJPEG() throws BarcodeException,
        IOException, OutputException {
    Barcode barcode3 = BarcodeFactory.createCode128C("123456");
    barcode3.setResolution(300);
    BarcodeImageHandler.saveJPEG(barcode3, new File("123456.jpg"));
}
 
开发者ID:nakomis,项目名称:barbecue,代码行数:7,代码来源:FormatExample.java


注:本文中的net.sourceforge.barbecue.BarcodeFactory类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。