Мне нужно создавать штрих-коды, когда определенное количество вводится в текстовое поле. Может показаться, что оно работает с этими кодами, которые я сделал. любая помощь будет оценена по достоинству.
import com.aspose.barcode.BarCodeBuilder;
import com.aspose.barcode.Symbology;
import com.aspose.words.Document;
import com.aspose.words.DocumentBuilder;
JButton btnCreate = new JButton("Create Barcode");
btnCreate.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent arg0) {
String strBaseFolder = "C:\\users\\ronjonathan\\desktop\\barcode\\";
try
{
// Generate barcode image
BarCodeBuilder builder = new BarCodeBuilder();
builder.setSymbologyType(Symbology.Code128);
for(int i = 1;i <= Integer.parseInt(txtBarcode.getText()); i++){
builder.setCodeText(Integer.toString(i));
String strBarCodeImageSave = "img.jpg"+ i;
builder.save(strBaseFolder + strBarCodeImageSave);
Каждый раз, когда вы запускаете этот код, вы пишете над тем же файлом "img.jpg". Попробуйте изменить
String strBarCodeImageSave = "img.jpg";
в
String strBarCodeImageSave = txtBarcode.getText() + ".jpg";