本文整理汇总了Java中net.sourceforge.barbecue.Barcode类的典型用法代码示例。如果您正苦于以下问题:Java Barcode类的具体用法?Java Barcode怎么用?Java Barcode使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Barcode类属于net.sourceforge.barbecue包,在下文中一共展示了Barcode类的16个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: createBarcode
import net.sourceforge.barbecue.Barcode; //导入依赖的package包/类
@Override
public Barcode createBarcode(BarcodeInfo barcodeInfo)
throws BarcodeException
{
Barcode barcode = createBaseBarcode(barcodeInfo);
barcode.setDrawingText(barcodeInfo.isDrawText());
if (barcodeInfo.getBarWidth() != null)
{
barcode.setBarWidth(barcodeInfo.getBarWidth().intValue());
}
if (barcodeInfo.getBarHeight() != null)
{
barcode.setBarHeight(barcodeInfo.getBarHeight().intValue());
}
return barcode;
}
开发者ID:TIBCOSoftware,项目名称:jasperreports,代码行数:17,代码来源:BaseBarcodeProvider.java
示例2: createBarcode
import net.sourceforge.barbecue.Barcode; //导入依赖的package包/类
public static Barcode createBarcode(BarcodeInfo barcodeInfo)
{
initProviders();
BarcodeProvider provider = providers.get(
barcodeInfo.getType());
if (provider == null)
{
throw
new JRRuntimeException(
EXCEPTION_MESSAGE_KEY_BARCODE_PROVIDER_NOT_FOUND,
new Object[]{barcodeInfo.getType()});
}
try
{
return provider.createBarcode(barcodeInfo);
}
catch (BarcodeException e)
{
throw
new JRRuntimeException(
EXCEPTION_MESSAGE_KEY_ERROR_CREATING_BARCODE,
(Object[])null,
e);
}
}
开发者ID:TIBCOSoftware,项目名称:jasperreports,代码行数:27,代码来源:BarcodeProviders.java
示例3: setBarcodeImage
import net.sourceforge.barbecue.Barcode; //导入依赖的package包/类
protected void setBarcodeImage(JRTemplatePrintImage image)
{
BarcodeInfo barcodeInfo = new BarcodeInfo();
barcodeInfo.setType(barcodeComponent.getType());
barcodeInfo.setCode(code);
barcodeInfo.setApplicationIdentifier(applicationIdentifier);
barcodeInfo.setDrawText(barcodeComponent.isDrawText());
barcodeInfo.setRequiresChecksum(barcodeComponent.isChecksumRequired());
barcodeInfo.setBarWidth(barcodeComponent.getBarWidth());
barcodeInfo.setBarHeight(barcodeComponent.getBarHeight());
Barcode barcode = BarcodeProviders.createBarcode(barcodeInfo);
BarbecueRendererImpl renderer = new BarbecueRendererImpl(barcode);
renderer.setRotation(BarbecueStyleResolver.getRotationValue(fillContext.getComponentElement()));
image.setRenderer(renderer);
}
开发者ID:TIBCOSoftware,项目名称:jasperreports,代码行数:18,代码来源:BarbecueFillComponent.java
示例4: drawingBarcodeDirectToGraphics
import net.sourceforge.barbecue.Barcode; //导入依赖的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
示例5: outputtingBarcodeAsPNG
import net.sourceforge.barbecue.Barcode; //导入依赖的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
示例6: testDrawingSmallBarcodeDoesNotDrawBarsTooSmall
import net.sourceforge.barbecue.Barcode; //导入依赖的package包/类
public void testDrawingSmallBarcodeDoesNotDrawBarsTooSmall() throws Exception {
Barcode b = new Code128Barcode("123456789012345678901209284390690347603740673047602730496734567890");
boolean done = false;
int width = 1;
while (! done) {
width = width - 1;
b.setBarWidth(width);
GraphicsMock g = new GraphicsMock();
b.draw(g, 0, 0);
List rects = g.getRects();
for (Iterator iterator = rects.iterator(); iterator.hasNext();) {
Rectangle rectangle = (Rectangle) iterator.next();
assertTrue(rectangle.getWidth() >= 1);
}
if (width < 1) {
done = true;
}
}
}
开发者ID:nakomis,项目名称:barbecue,代码行数:20,代码来源:Code128BarcodeTest.java
示例7: createBaseBarcode
import net.sourceforge.barbecue.Barcode; //导入依赖的package包/类
@Override
protected Barcode createBaseBarcode(BarcodeInfo barcodeInfo)
throws BarcodeException
{
return BarcodeFactory.create3of9(barcodeInfo.getCode(),
barcodeInfo.getRequiresChecksum());
}
开发者ID:TIBCOSoftware,项目名称:jasperreports,代码行数:8,代码来源:BarcodeProviders.java
示例8: outputtingBarcode128x1
import net.sourceforge.barbecue.Barcode; //导入依赖的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
示例9: outputtingBarcode128x2
import net.sourceforge.barbecue.Barcode; //导入依赖的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
示例10: outputtingBarcode128x3
import net.sourceforge.barbecue.Barcode; //导入依赖的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
示例11: outputtingBarcode128x4
import net.sourceforge.barbecue.Barcode; //导入依赖的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
示例12: usingBarbecueAsSwingComponent
import net.sourceforge.barbecue.Barcode; //导入依赖的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
示例13: format
import net.sourceforge.barbecue.Barcode; //导入依赖的package包/类
public void format(Barcode barcode) throws FormattingException {
try {
barcode.output(new SVGOutput(out, barcode.getFont(),
barcode.getForeground(), barcode.getBackground(),
scalar, units));
}
catch (OutputException e) {
throw new FormattingException(e.getMessage(), e);
}
}
开发者ID:nakomis,项目名称:barbecue,代码行数:11,代码来源:SVGFormatter.java
示例14: testSizeCalculationIsSameForDrawnAndNotDrawnBarcode
import net.sourceforge.barbecue.Barcode; //导入依赖的package包/类
public void testSizeCalculationIsSameForDrawnAndNotDrawnBarcode() throws Exception {
Barcode b = new Code128Barcode("123456789012345678901209284390690347603740673047602730496734567890", Code128Barcode.B);
b.setBarWidth(15);
int unDrawnWidth = b.getWidth();
BufferedImage image = new BufferedImage(5000, 5000, BufferedImage.TYPE_BYTE_GRAY);
b.draw((Graphics2D) image.getGraphics(), 0, 0);
int drawnWidth = b.getWidth();
assertEquals(drawnWidth, unDrawnWidth);
}
开发者ID:nakomis,项目名称:barbecue,代码行数:10,代码来源:Code128BarcodeTest.java
示例15: BarbecueRenderer
import net.sourceforge.barbecue.Barcode; //导入依赖的package包/类
/**
*
*/
public BarbecueRenderer(Barcode barcode)
{
this.barcode = barcode;
}
开发者ID:williamgrosset,项目名称:OSCAR-ConCert,代码行数:8,代码来源:BarbecueRenderer.java
示例16: createBaseBarcode
import net.sourceforge.barbecue.Barcode; //导入依赖的package包/类
protected abstract Barcode createBaseBarcode(BarcodeInfo barcodeInfo)
throws BarcodeException;
开发者ID:TIBCOSoftware,项目名称:jasperreports,代码行数:3,代码来源:BaseBarcodeProvider.java
注:本文中的net.sourceforge.barbecue.Barcode类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论