I'm using barbecue to generate barcodes in java. It generates barcodes successfully but there is a small issue. I would like to add some little text just above the barcode. I would also like to change the font size/style of the text/numbers below the barcode and remove the underline as well. How do you go about that?
Here's my code:
private void btnGenerateBarcodeActionPerformed(java.awt.event.ActionEvent evt) {
// TODO add your handling code here:
String text=txtText.getText();
File file = new File("path/to/destination/file");
try {
Barcode barcode = BarcodeFactory.createCode128(text);
barcode.setBarHeight(50);
barcode.setBarWidth(1);
BarcodeImageHandler.saveJPEG(barcode,file);
JOptionPane.showMessageDialog(this, "Barcode generated successfully!",
"Success",JOptionPane.INFORMATION_MESSAGE);
} catch (Exception e) {
JOptionPane.showMessageDialog(this, "Error generating barcode\n"+e.toString(),
"Error",JOptionPane.ERROR_MESSAGE);
}
}