tl  tr
  Home | Tutorials | Articles | Videos | Products | Tools | Search
Interviews | Open Source | Tag Cloud | Follow Us | Bookmark | Contact   
 Barcodes > Barbecue > Barcode As Swing Component

Barcode As Swing Component 

Barbecue is a free and open source Java library for Barcode generation. This requires the library barbecue-1.5-beta1.jar to be in classpath. The following example shows rendering CODE 128B Barcode as Swing component.

File Name  :  
com/bethecoder/tutorials/barbecue/BarCodeAsSwingComponentTest.java 
Author  :  Sudhakar KV
Email  :  [email protected]
   
package com.bethecoder.tutorials.barbecue;

import javax.swing.JFrame;

import net.sourceforge.barbecue.Barcode;
import net.sourceforge.barbecue.BarcodeFactory;

public class BarCodeAsSwingComponentTest {

  public static void main (String [] argsthrows Exception {

    //Get 128B Barcode instance from the Factory
    Barcode barcode = BarcodeFactory.createCode128B("be the coder");

    JFrame frame = new JFrame("My Application");
      frame.getContentPane().add(barcode);
      frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
      
      frame.pack();
      frame.setLocation(24090);
      frame.setVisible(true);
  }
}
   

It gives the following output,

CODE 128B Barcode



 
  


  
bl  br