List of usage examples for com.itextpdf.text Phrase Phrase
private Phrase(final boolean dummy)
From source file:com.devox.GUI.PDF.CrearReporteTarimas.java
@Override public void agregarProductos(PdfPTable table) { int rows = datosTarima.getListaProductos().size(); int total = 0; for (int i = 0; i < rows; i++) { PdfPCell cell = new PdfPCell(); cell.addElement(new Phrase(datosTarima.getListaProductos().get(i)[0])); table.addCell(cell);//from www . j a va 2 s . com table.addCell(new Phrase(datosTarima.getListaProductos().get(i)[1])); table.addCell(new Phrase(datosTarima.getListaProductos().get(i)[2])); int c = Integer.parseInt(datosTarima.getListaProductos().get(i)[3]); total += c; table.addCell(datosTarima.getListaProductos().get(i)[3]); } table.addCell(new Phrase(" ", FUENTE_BASE_TABLA)); table.addCell(new Phrase("Total ", FUENTE_BASE_TABLA)); table.addCell(new Phrase(" ", FUENTE_BASE_TABLA)); table.addCell(new Phrase("" + total, FUENTE_BASE_TABLA)); }
From source file:com.devox.GUI.PDF.ExportarAPDF.java
private void addProductosTarimas(PdfPTable table) { int rows = datosTarima.getListaProductos().size(); int total = 0; for (int i = 0; i < rows; i++) { PdfPCell cell = new PdfPCell(); cell.addElement(new Phrase(datosTarima.getListaProductos().get(i)[0])); table.addCell(cell);/*from w w w.ja v a 2 s. c o m*/ table.addCell(new Phrase(datosTarima.getListaProductos().get(i)[1])); table.addCell(new Phrase(datosTarima.getListaProductos().get(i)[2])); int c = Integer.parseInt(datosTarima.getListaProductos().get(i)[3]); total += c; table.addCell(datosTarima.getListaProductos().get(i)[3]); } table.addCell(new Phrase(" ", font_bottomtable)); table.addCell(new Phrase("Total ", font_bottomtable)); table.addCell(new Phrase(" ", font_bottomtable)); table.addCell(new Phrase("" + total, font_bottomtable)); }
From source file:com.devox.GUI.PDF.ExportarAPDF.java
public void addProductos(DefaultTableModel model, PdfPTable table) { int rows = model.getRowCount(); int total = 0; float monto = 0f; for (int i = 0; i < rows; i++) { PdfPCell cell = new PdfPCell(); cell.addElement(new Phrase((String) model.getValueAt(i, 2))); table.addCell(cell);//from w w w.j av a 2 s .c o m if (ANI) { String lote = ((String) model.getValueAt(i, 3)); String[] l = lote.split(" "); String[] l2; l2 = l[0].split("00"); table.addCell(l2[0]); } else { table.addCell((String) model.getValueAt(i, 3)); } table.addCell((String) model.getValueAt(i, 1)); int c = (Integer) model.getValueAt(i, 5); total += c; table.addCell(Integer.toString(c)); table.addCell("$ " + model.getValueAt(i, 4).toString()); Float p = new Float(model.getValueAt(i, 6).toString()); monto += p; table.addCell("$ " + String.format("%.2f", p)); } table.addCell(new Phrase(" ", font_bottomtable)); table.addCell(new Phrase("Total ", font_bottomtable)); table.addCell(new Phrase(" ", font_bottomtable)); table.addCell(new Phrase("" + total, font_bottomtable)); table.addCell(new Phrase(" ", font_bottomtable)); table.addCell(new Phrase("$ " + String.format("%.2f", monto), font_bottomtable)); }
From source file:com.equiworx.util.Main.java
private static void createTable(Section subCatPart) throws BadElementException { PdfPTable table = new PdfPTable(3); // t.setBorderColor(BaseColor.GRAY); // t.setPadding(4); // t.setSpacing(4); // t.setBorderWidth(1); PdfPCell c1 = new PdfPCell(new Phrase("Job Name:")); c1.setHorizontalAlignment(Element.ALIGN_CENTER); table.addCell(c1);/*www . ja v a 2 s.c o m*/ c1 = new PdfPCell(new Phrase("Test 001")); c1.setHorizontalAlignment(Element.ALIGN_CENTER); table.addCell(c1); c1 = new PdfPCell(new Phrase("")); c1.setHorizontalAlignment(Element.ALIGN_CENTER); table.addCell(c1); table.setHeaderRows(1); table.addCell("Date:"); table.addCell("1.1"); table.addCell(""); table.addCell("Labor Rate:"); table.addCell("2.2"); table.addCell(""); table.addCell("Labor Cost:"); table.addCell("3.2"); table.addCell("3.3"); subCatPart.add(table); }
From source file:com.etest.pdfgenerator.InventoryItemsReportPDF.java
public InventoryItemsReportPDF() { Document document = null;/*from www . j a v a 2 s . com*/ Date date = new Date(); try { document = new Document(PageSize.LETTER.rotate(), 50, 50, 50, 50); PdfWriter.getInstance(document, outputStream); document.open(); Font header = FontFactory.getFont("Times-Roman", 12, Font.BOLD); Font content = FontFactory.getFont("Times-Roman", 10); Font dateFont = FontFactory.getFont("Times-Roman", 8); Image img = null; try { img = Image.getInstance("C:\\eTest-images\\SUCN_seal.png"); img.scaleToFit(60, 60); img.setAbsolutePosition(650, 500); } catch (BadElementException | IOException ex) { Logger.getLogger(TQCoveragePDF.class.getName()).log(Level.SEVERE, null, ex); } document.add(img); Paragraph title1 = new Paragraph(); title1.setAlignment(Element.ALIGN_CENTER); title1.add(new Phrase("Inventory of Items Report")); document.add(title1); Paragraph title2 = new Paragraph(); title2.setAlignment(Element.ALIGN_CENTER); title2.add(new Phrase("Grouped According to the Revised Bloom's Taxonomy")); document.add(title2); Paragraph datePrinted = new Paragraph(); datePrinted.setSpacingAfter(20f); datePrinted.setAlignment(Element.ALIGN_CENTER); datePrinted .add(new Phrase("Date printed: " + new SimpleDateFormat("dd MMMM yyyy").format(date), content)); document.add(datePrinted); PdfPTable table = new PdfPTable(8); table.setWidthPercentage(100); table.setSpacingAfter(5f); for (int i = 0; i < tableHeader.length; i++) { PdfPCell cell = new PdfPCell(new Phrase(tableHeader[i], header)); cell.setBorder(Rectangle.NO_BORDER); cell.setPaddingLeft(10); cell.setVerticalAlignment(Element.ALIGN_MIDDLE); if (tableHeader[i].equals("Subject")) { cell.setHorizontalAlignment(Element.ALIGN_JUSTIFIED); } else { cell.setHorizontalAlignment(Element.ALIGN_CENTER); } table.addCell(cell); } document.add(table); for (InventoryOfCasesReport report : service.getInventoryOfCases()) { PdfPTable table2 = new PdfPTable(8); table2.setWidthPercentage(100); table2.setSpacingBefore(3f); table2.setSpacingAfter(3f); if (!service.getListOfSyllabusIdByCurriculumId(report.getCurriculumId()).isEmpty()) { if (!service .getListOfCellCaseIdBySyllabusId( service.getListOfSyllabusIdByCurriculumId(report.getCurriculumId())) .isEmpty()) { PdfPCell cell1 = new PdfPCell(new Paragraph(report.getSubject(), content)); cell1.setBorder(0); cell1.setPaddingLeft(10); cell1.setHorizontalAlignment(Element.ALIGN_JUSTIFIED); cell1.setVerticalAlignment(Element.ALIGN_MIDDLE); PdfPCell cell2 = new PdfPCell( new Paragraph(String.valueOf(service.getTotalItemsByBloomsTaxonomy( service.getListOfCellCaseIdBySyllabusId(service .getListOfSyllabusIdByCurriculumId(report.getCurriculumId())), tq.getBloomsClassId(BloomsClass.Remember.toString()))), content)); cell2.setBorder(0); cell2.setPaddingLeft(10); cell2.setHorizontalAlignment(Element.ALIGN_CENTER); cell2.setVerticalAlignment(Element.ALIGN_MIDDLE); PdfPCell cell3 = new PdfPCell( new Paragraph(String.valueOf(service.getTotalItemsByBloomsTaxonomy( service.getListOfCellCaseIdBySyllabusId(service .getListOfSyllabusIdByCurriculumId(report.getCurriculumId())), tq.getBloomsClassId(BloomsClass.Understand.toString()))), content)); cell3.setBorder(0); cell3.setPaddingLeft(10); cell3.setHorizontalAlignment(Element.ALIGN_CENTER); cell3.setVerticalAlignment(Element.ALIGN_MIDDLE); PdfPCell cell4 = new PdfPCell( new Paragraph(String.valueOf(service.getTotalItemsByBloomsTaxonomy( service.getListOfCellCaseIdBySyllabusId(service .getListOfSyllabusIdByCurriculumId(report.getCurriculumId())), tq.getBloomsClassId(BloomsClass.Apply.toString()))), content)); cell4.setBorder(0); cell4.setPaddingLeft(10); cell4.setHorizontalAlignment(Element.ALIGN_CENTER); cell4.setVerticalAlignment(Element.ALIGN_MIDDLE); PdfPCell cell5 = new PdfPCell( new Paragraph(String.valueOf(service.getTotalItemsByBloomsTaxonomy( service.getListOfCellCaseIdBySyllabusId(service .getListOfSyllabusIdByCurriculumId(report.getCurriculumId())), tq.getBloomsClassId(BloomsClass.Analyze.toString()))), content)); cell5.setBorder(0); cell5.setPaddingLeft(10); cell5.setHorizontalAlignment(Element.ALIGN_CENTER); cell5.setVerticalAlignment(Element.ALIGN_MIDDLE); PdfPCell cell6 = new PdfPCell( new Paragraph(String.valueOf(service.getTotalItemsByBloomsTaxonomy( service.getListOfCellCaseIdBySyllabusId(service .getListOfSyllabusIdByCurriculumId(report.getCurriculumId())), tq.getBloomsClassId(BloomsClass.Evaluate.toString()))), content)); cell6.setBorder(0); cell6.setPaddingLeft(10); cell6.setHorizontalAlignment(Element.ALIGN_CENTER); cell6.setVerticalAlignment(Element.ALIGN_MIDDLE); PdfPCell cell7 = new PdfPCell( new Paragraph(String.valueOf(service.getTotalItemsByBloomsTaxonomy( service.getListOfCellCaseIdBySyllabusId(service .getListOfSyllabusIdByCurriculumId(report.getCurriculumId())), tq.getBloomsClassId(BloomsClass.Create.toString()))), content)); cell7.setBorder(0); cell7.setPaddingLeft(10); cell7.setHorizontalAlignment(Element.ALIGN_CENTER); cell7.setVerticalAlignment(Element.ALIGN_MIDDLE); PdfPCell cell8 = new PdfPCell(new Paragraph( String.valueOf(service.getTotalCellItemsByCellCaseId( service.getListOfCellCaseIdBySyllabusId(service .getListOfSyllabusIdByCurriculumId(report.getCurriculumId())))), content)); cell8.setBorder(0); cell8.setPaddingLeft(10); cell8.setHorizontalAlignment(Element.ALIGN_CENTER); cell8.setVerticalAlignment(Element.ALIGN_MIDDLE); table2.addCell(cell1); table2.addCell(cell2); table2.addCell(cell3); table2.addCell(cell4); table2.addCell(cell5); table2.addCell(cell6); table2.addCell(cell7); table2.addCell(cell8); document.add(table2); } } } } catch (DocumentException ex) { Logger.getLogger(InventoryItemsReportPDF.class.getName()).log(Level.SEVERE, null, ex); } finally { document.close(); } }
From source file:com.example.admin.avoidq.billGenerated.java
private void generatePDF(final String personName) { new Thread(new Runnable() { public void run() { // a potentially time consuming task //create a new document Document document = new Document(); try { PdfWriter docWriter = PdfWriter.getInstance(document, new FileOutputStream(pdfFile)); document.open();//from ww w. j av a 2 s. c om PdfContentByte cb = docWriter.getDirectContent(); //initialize fonts for text printing initializeFonts(); //the company logo is stored in the assets which is read only //get the logo and print on the document /* try { bitmap11 = encodeAsBitmap(barcode_data, BarcodeFormat.CODE_128, 600, 300); iv.setImageBitmap(bitmap11); } catch (WriterException e) { e.printStackTrace(); } * */ InputStream inputStream = getAssets().open("sale.png"); Bitmap bmp = null;//BitmapFactory.decodeStream(inputStream); bmp = bitmap11; ByteArrayOutputStream stream = new ByteArrayOutputStream(); bmp.compress(Bitmap.CompressFormat.PNG, 100, stream); Image companyLogo = Image.getInstance(stream.toByteArray()); companyLogo.setAbsolutePosition(25, 700); companyLogo.scalePercent(65); document.add(companyLogo); Calendar calendar = Calendar.getInstance(); SimpleDateFormat df1 = new SimpleDateFormat("dd-MM-yyyy"); String formattedDate = df1.format(calendar.getTime()); //creating a sample invoice with some customer data createHeadings(cb, 400, 780, "Date :"); createHeadings(cb, 430, 780, formattedDate); String fname = customer.getName(); String lname = customer.getSurname(); createHeadings(cb, 400, 765, "Customer :"); createHeadings(cb, 445, 765, fname + " " + lname); String mob = customer.getMobile_no(); createHeadings(cb, 400, 750, "Mobile No :"); createHeadings(cb, 445, 750, mob); createHeadings(cb, 400, 735, "Shop :"); createHeadings(cb, 430, 735, "Empress Mall"); createHeadings(cb, 400, 720, "City :"); createHeadings(cb, 430, 720, "Nagpur"); // createHeadings(cb,400,720,"Country"); //list all the products sold to the customer float[] columnWidths = { 1.5f, 3f, 2.5f, 2.5f, 2f, 2f }; //create PDF table with the given widths PdfPTable table = new PdfPTable(columnWidths); // set table width a percentage of the page width table.setTotalWidth(500f); PdfPCell cell = new PdfPCell(new Phrase("S.NO")); cell.setHorizontalAlignment(Element.ALIGN_CENTER); table.addCell(cell); cell = new PdfPCell(new Phrase("Item Name")); cell.setHorizontalAlignment(Element.ALIGN_CENTER); table.addCell(cell); cell = new PdfPCell(new Phrase("Price")); cell.setHorizontalAlignment(Element.ALIGN_CENTER); table.addCell(cell); cell = new PdfPCell(new Phrase("Quantity")); cell.setHorizontalAlignment(Element.ALIGN_CENTER); table.addCell(cell); cell = new PdfPCell(new Phrase("Discount")); cell.setHorizontalAlignment(Element.ALIGN_CENTER); table.addCell(cell); cell = new PdfPCell(new Phrase("Amount")); cell.setHorizontalAlignment(Element.ALIGN_CENTER); table.addCell(cell); table.setHeaderRows(1); /*DecimalFormat df = new DecimalFormat("0.000"); for(int i=0; i < 10; i++ ){ double price = Double.valueOf(df.format(Math.random() * 10)); double extPrice = price * (i+1) ; table.addCell(String.valueOf(i+1)); table.addCell("ITEM" + String.valueOf(i+1)); table.addCell(String.valueOf(5*i)); table.addCell(String.valueOf(1)); table.addCell(String.valueOf(i)+ " %"); table.addCell(df.format(extPrice)); }*/ int sr = 0; DecimalFormat df = new DecimalFormat("0.0"); double total_price = 0; //Log.i("c0","c0 = "+carts[0].getItemname()+" "+String.valueOf(carts[0].getPrice())); // Log.i("c1","c1 = "+carts[1].getItemname()+" "+String.valueOf(carts[1].getPrice())); for (Cart cd : carts) { Log.i("cartscheck", "carts check = " + cd.getBarcode() + " " + cd.getItemname() + " " + String.valueOf(cd.getPrice())); } for (Cart c : carts) { double price = c.getPrice(); int quantity = c.getQuantity(); price = (price / quantity); double discont = c.getDiscount(); sr++; table.addCell(String.valueOf(sr)); table.addCell(c.getItemname()); table.addCell(df.format(price)); table.addCell(String.valueOf(quantity)); table.addCell(df.format(discont) + " %"); double total = (price * quantity); total_price = total_price + total; Log.i("total", "total in for loop = " + String.valueOf(total)); table.addCell(df.format(total)); } float headerHeight = table.getHeaderHeight(); Log.i("headerHeight", String.valueOf(headerHeight)); //absolute location to print the PDF table from table.writeSelectedRows(0, -1, document.leftMargin(), 650, docWriter.getDirectContent()); float total_height = table.getTotalHeight(); Log.i("total_height", String.valueOf(total_height)); createHeadings(cb, 420, 750f - 125f - total_height, "Total Price = "); createHeadings(cb, 475, 750f - 125f - total_height, String.valueOf(total_price)); //print the signature image along with the persons name inputStream = getAssets().open("user.png"); bmp = BitmapFactory.decodeStream(inputStream); stream = new ByteArrayOutputStream(); bmp.compress(Bitmap.CompressFormat.PNG, 100, stream); Image signature = Image.getInstance(stream.toByteArray()); signature.setAbsolutePosition(400f, 750f - 125f - total_height - 60f); signature.scalePercent(35f); document.add(signature); createHeadings(cb, 450, 750f - 125f - total_height - 80f, fname + " " + lname); document.close(); } catch (Exception e) { e.printStackTrace(); } //PDF file is now ready to be sent to the bluetooth printer using PrintShare Intent i = new Intent(Intent.ACTION_VIEW); // i.setPackage("com.dynamixsoftware.printershare"); i.setDataAndType(Uri.fromFile(pdfFile), "application/pdf"); startActivity(i); } }).start(); }
From source file:com.example.drivequickstart.PDFActivity.java
private void createTable(Section subCatPart) throws BadElementException { PdfPTable table = new PdfPTable(3); // t.setBorderColor(BaseColor.GRAY); // t.setPadding(4); // t.setSpacing(4); // t.setBorderWidth(1); PdfPCell c1 = new PdfPCell(new Phrase("Job Name:")); c1.setHorizontalAlignment(Element.ALIGN_CENTER); table.addCell(c1);// ww w .jav a 2s .co m c1 = new PdfPCell(new Phrase("Test 001")); c1.setHorizontalAlignment(Element.ALIGN_CENTER); table.addCell(c1); c1 = new PdfPCell(new Phrase("")); c1.setHorizontalAlignment(Element.ALIGN_CENTER); table.addCell(c1); table.setHeaderRows(1); table.addCell("Date:"); table.addCell("1.1"); table.addCell(""); table.addCell("Labor Rate:"); table.addCell("2.2"); table.addCell(""); table.addCell("Labor Cost:"); table.addCell("3.2"); table.addCell("3.3"); subCatPart.add(table); }
From source file:com.example.pdfcreate.MainActivity.java
private static void createTable(Section subCatPart) throws BadElementException { PdfPTable table = new PdfPTable(3); // t.setBorderColor(BaseColor.GRAY); // t.setPadding(4); // t.setSpacing(4); // t.setBorderWidth(1); PdfPCell c1 = new PdfPCell(new Phrase("Job Name:")); c1.setHorizontalAlignment(Element.ALIGN_CENTER); table.addCell(c1);/* w w w. j a v a2 s. c o m*/ c1 = new PdfPCell(new Phrase("Test 001")); c1.setHorizontalAlignment(Element.ALIGN_CENTER); table.addCell(c1); c1 = new PdfPCell(new Phrase("")); c1.setHorizontalAlignment(Element.ALIGN_CENTER); table.addCell(c1); table.setHeaderRows(1); table.addCell("Date:"); table.addCell("1.1"); table.addCell(""); table.addCell("Labor Rate:"); table.addCell("2.2"); table.addCell(""); table.addCell("Labor Cost:"); table.addCell("3.2"); table.addCell("3.3"); //subCatPart.add(table); }
From source file:com.gadroves.gsisinve.controller.FacturarController.java
private void createItemsTable(Document doc, TbFacturaVenta facturaVenta) throws DocumentException { PdfPTable table = new PdfPTable(4); PdfPCell c1 = new PdfPCell(new Phrase("Descripcion")); c1.setHorizontalAlignment(Element.ALIGN_CENTER); table.addCell(c1);/*www. j a v a2 s . c om*/ c1 = new PdfPCell(new Phrase("Cantidad")); c1.setHorizontalAlignment(Element.ALIGN_CENTER); table.addCell(c1); c1 = new PdfPCell(new Phrase("Precio Unitario")); c1.setHorizontalAlignment(Element.ALIGN_CENTER); table.addCell(c1); c1 = new PdfPCell(new Phrase("Valor")); c1.setHorizontalAlignment(Element.ALIGN_CENTER); table.addCell(c1); //table.setHeaderRows(1); PdfPCell desc; PdfPCell cant; PdfPCell pu; PdfPCell val; for (TbLineaFac lineaFac : facturaVenta.getTbLineaFacsById()) { desc = new PdfPCell(new Phrase(lineaFac.getDescripcion())); cant = new PdfPCell(new Phrase(String.valueOf(lineaFac.getQuant()))); pu = new PdfPCell(new Phrase(String.valueOf(lineaFac.getP_unitario()))); val = new PdfPCell(new Phrase(String.valueOf(lineaFac.getTotal()))); table.addCell(desc); table.addCell(cant); table.addCell(pu); table.addCell(val); } float[] columnWidths = new float[] { 40f, 10f, 10f, 10f }; table.setWidths(columnWidths); doc.add(table); }
From source file:com.github.luischavez.levsym.modulos.funcion.PDF.java
License:Open Source License
public void GeneraPDF(ResultSet Resultados) throws Exception { ResultSetMetaData metaData = Resultados.getMetaData(); Object[] Columnas = new Object[metaData.getColumnCount()]; String encabezado = "Reportes del Sistema Administrativo" + "\n" + "REGISTROS ACTUALES EN AL BASE DE DATOS" + "\n" + "\n" + "\n" + "\n" + "\n" + "\n" + "\n"; Calendar c = Calendar.getInstance(); String date = Integer.toString(c.get(Calendar.DAY_OF_MONTH)) + "-" + Integer.toString(c.get(Calendar.MONTH)) + "-" + Integer.toString(c.get(Calendar.YEAR)) + " " + Integer.toString(c.get(Calendar.HOUR_OF_DAY)) + "-" + Integer.toString(c.get(Calendar.MINUTE)) + "-" + Integer.toString(c.get(Calendar.SECOND)); Font fuente = new Font(Font.getFamily("ARIAL"), 12, Font.BOLD); String choro = "Reporte por fecha de los modulos\n" + "de catalogo" + "\n" + "Systema Administrativo" + "\n" + "\n" + "\n" + "\n"; Image imagen = Image.getInstance(System.getProperty("user.dir") + "/Image/logo.png"); imagen.setAlignment(Image.TEXTWRAP); try {//from ww w . j av a 2s . co m Paragraph linea = new Paragraph(encabezado, fuente); Phrase para = new Phrase(choro); Paragraph fecha = new Paragraph(date + "\n" + "\n"); PdfPTable tabla = new PdfPTable(Columnas.length); tabla.setWidthPercentage(100); //Document documento = new Document(PageSize.LETTER); Document documento = new Document(PageSize.A4.rotate(), 50, 50, 100, 72); File Dir = new File(System.getProperty("user.dir") + "/Reportes/"); if (!Dir.exists()) { Dir.mkdirs(); } String file = System.getProperty("user.dir") + "/Reportes/" + metaData.getTableName(1) + " " + date + ".pdf"; PdfWriter.getInstance(documento, new FileOutputStream(file)); documento.open(); documento.add(imagen); documento.add(linea); documento.add(para); documento.add(fecha); for (int x = 0; x < Columnas.length; x++) { PdfPCell Celda = new PdfPCell(new Paragraph(metaData.getColumnName(x + 1), FontFactory.getFont("arial", 9, Font.BOLD, BaseColor.RED))); Celda.setHorizontalAlignment(Element.ALIGN_CENTER); tabla.addCell(Celda); } while (Resultados.next()) { for (int x = 0; x < Columnas.length; x++) { //if(Resultados.getObject(x+1).getClass().getSimpleName().equals("Integer")) PdfPCell Celda = new PdfPCell(new Paragraph(String.valueOf(Resultados.getObject(x + 1)), FontFactory.getFont("arial", 9, BaseColor.BLACK))); Celda.setHorizontalAlignment(Element.ALIGN_CENTER); tabla.addCell(Celda); } } documento.add(tabla); documento.close(); } catch (DocumentException e) { Log.SaveLog(e.toString()); JOptionPane.showMessageDialog(null, e.getMessage(), "Error", JOptionPane.ERROR_MESSAGE); } catch (IOException e) { Log.SaveLog(e.toString()); JOptionPane.showMessageDialog(null, e.getMessage(), "error", JOptionPane.ERROR_MESSAGE); } }