List of usage examples for org.apache.pdfbox.pdmodel PDDocument getPage
public PDPage getPage(int pageIndex)
From source file:com.joowon.returnA.classifier.extractor.PdfTextExtractor.java
License:Open Source License
public static void main(String[] args) throws IOException, PrinterException { // Target PDF Document PDDocument document = PDDocument .load(new File("/Users/Joowon/Documents/Github/ReturnA/data/tests/YAPNXRPm_eng1_mun.pdf")); List<String> pdfTextList = new ArrayList<>(); final int width = (int) document.getPage(0).getMediaBox().getWidth(); final int height = (int) document.getPage(0).getMediaBox().getHeight(); // Extract Test Information (first page's info area) pdfTextList.addAll(new PdfTextExtractor(document.getPage(0)).addRegion(0, 0, width, height / 4).extract()); for (int i = 0; i < document.getNumberOfPages(); ++i) { // Left side pdfTextList/*w ww . ja v a 2 s.c o m*/ .addAll(new PdfTextExtractor(document.getPage(i)).addRegion(0, 0, width / 2, height).extract()); // Right side pdfTextList.addAll( new PdfTextExtractor(document.getPage(i)).addRegion(width / 2, 0, width / 2, height).extract()); } System.out.println(pdfTextList.toString()); }
From source file:com.przemo.pdfmanipulate.PDFBuilder.java
private static void renderForm(Formularz form, PDDocument doc) throws IOException { int i = 0;/*from w ww . ja v a2s. c o m*/ PDFont f = PDType1Font.HELVETICA; float fontSize = 17.0f; for (FormPage page : form.getPages()) { PDPage pag = doc.getPage(i); PDRectangle pageSize = pag.getMediaBox(); try (PDPageContentStream contentStream = new PDPageContentStream(doc, pag, PDPageContentStream.AppendMode.APPEND, false)) { contentStream.setFont(f, fontSize); contentStream.beginText(); contentStream.setNonStrokingColor(Color.black); for (Pole p : page.getPola()) { int x = p.getPozycjaX(); if (p.isRightAlign()) { x -= f.getStringWidth(p.getWartosc()) / 1000 * fontSize; } contentStream .setTextMatrix(Matrix.getTranslateInstance(x, pageSize.getHeight() - p.getPozycjaY())); contentStream.showText(p.getWartosc()); } contentStream.endText(); } i++; } }
From source file:de.redsix.pdfcompare.PdfComparator.java
License:Apache License
public static ImageWithDimension renderPageAsImage(final PDDocument document, final PDFRenderer expectedPdfRenderer, final int pageIndex) throws IOException { final BufferedImage bufferedImage = expectedPdfRenderer.renderImageWithDPI(pageIndex, DPI); final PDRectangle mediaBox = document.getPage(pageIndex).getMediaBox(); return new ImageWithDimension(bufferedImage, mediaBox.getWidth(), mediaBox.getHeight()); }
From source file:edu.ist.psu.sagnik.research.pdfbox2playground.javatest.ExtractImages.java
License:Apache License
private void extract(String pdfFile, String password) throws IOException { PDDocument document = null; try {// ww w . ja v a 2 s .c o m document = PDDocument.load(new File(pdfFile), password); AccessPermission ap = document.getCurrentAccessPermission(); if (!ap.canExtractContent()) { throw new IOException("You do not have permission to extract images"); } for (int i = 0; i < document.getNumberOfPages(); i++) // todo: ITERATOR would be much better { PDPage page = document.getPage(i); ImageGraphicsEngine extractor = new ImageGraphicsEngine(page); extractor.run(); } } finally { if (document != null) { document.close(); } } }
From source file:eu.europa.esig.dss.pades.signature.PAdESVisibleSignaturePositionTest.java
License:Open Source License
@Test @Ignore("for pull request #71") public void rotatePullRequest71Test() throws Exception { Logger logger = LoggerFactory.getLogger(getClass()); /**/*from www . j a va 2 s . co m*/ * minolta scanner normal(not rotated) pdf and rotation none. * * You can check the pdf rotation by this code: * PDDocument inputPDF = PDDocument.load(getClass().getResourceAsStream("/visualSignature/sun.pdf")); * System.out.println("rotation: " + inputPDF.getPage(0).getRotation()); * * result in pdf viewer: signature is top left corner and the sign image line is parallel with the sun eyes line * * comment: this is the original working */ PDDocument inputPDF = PDDocument.load(getClass().getResourceAsStream("/visualSignature/sun.pdf")); logger.info("rotation sun.pdf: " + inputPDF.getPage(0).getRotation()); SignatureImageParameters signatureImageParameters = createSignatureImageParameters(); signatureImageParameters.setRotation(SignatureImageParameters.VisualSignatureRotation.NONE); DSSDocument document = sign(signablePdfs.get("minoltaScan")); File checkPdfFile = new File("target/pdf/check_normal_none.pdf"); checkPdfFile.getParentFile().mkdirs(); IOUtils.copy(document.openStream(), new FileOutputStream(checkPdfFile)); /** * minolta scanner rotated pdf and rotation none (in pdf view the rotated and normal pdf seem equal) * you can check the pdf rotation by this code: * PDDocument inputPDF = PDDocument.load(getClass().getResourceAsStream("/visualSignature/sun_90.pdf")); * System.out.println("rotation: " + inputPDF.getPage(0).getRotation()); * * result in pdf viewer: signature is top right corner and the sign image line is perpendicular with the sun * eyes line * * comment: this is the original working */ inputPDF = PDDocument.load(getClass().getResourceAsStream("/visualSignature/sun_90.pdf")); logger.info("rotation sun_90.pdf: " + inputPDF.getPage(0).getRotation()); signatureImageParameters = createSignatureImageParameters(); signatureImageParameters.setRotation(SignatureImageParameters.VisualSignatureRotation.NONE); document = sign(signablePdfs.get("minoltaScan90")); checkPdfFile = new File("target/pdf/check_90_none.pdf"); checkPdfFile.getParentFile().mkdirs(); IOUtils.copy(document.openStream(), new FileOutputStream(checkPdfFile)); /** * minolta scanner rotated pdf and rotation automatic (in pdf view the rotated and normal pdf seem equal) * * result in pdf viewer: signature is top left corner and the sign image line is parallel with the sun eyes * line, * it will be same as with sun.pdf (not rotated) and rotation none */ signatureImageParameters = createSignatureImageParameters(); signatureImageParameters.setRotation(SignatureImageParameters.VisualSignatureRotation.AUTOMATIC); document = sign(signablePdfs.get("minoltaScan90")); checkPdfFile = new File("target/pdf/check_90_automatic.pdf"); checkPdfFile.getParentFile().mkdirs(); IOUtils.copy(document.openStream(), new FileOutputStream(checkPdfFile)); /** * minolta scanner normal(not rotated) pdf and rotation none. * * result in pdf viewer: signature is top left corner and the sign image line is parallel with the sun eyes * line, * it will be same as with sun.pdf (not rotated) and rotation none */ signatureImageParameters = createSignatureImageParameters(); signatureImageParameters.setRotation(SignatureImageParameters.VisualSignatureRotation.AUTOMATIC); document = sign(signablePdfs.get("minoltaScan")); checkPdfFile = new File("target/pdf/check_normal_automatic.pdf"); checkPdfFile.getParentFile().mkdirs(); IOUtils.copy(document.openStream(), new FileOutputStream(checkPdfFile)); }
From source file:fi.riista.feature.permit.invoice.pdf.PermitHarvestInvoicePdfBuilder.java
private PermitHarvestInvoicePdfBuilder(final PDDocument pdfDocument, final PermitHarvestInvoicePdfModel model) { this.pdfDocument = Objects.requireNonNull(pdfDocument); this.pdfPage = Objects.requireNonNull(pdfDocument.getPage(0)); this.acroForm = Objects.requireNonNull(pdfDocument.getDocumentCatalog().getAcroForm()); this.model = Objects.requireNonNull(model); }
From source file:fys.StatistiekenController.java
@FXML private void handleExportToPDFAction(ActionEvent event) throws IOException { if ((dateFrom.getText() == null || dateFrom.getText().trim().isEmpty()) || (dateTo.getText() == null || dateTo.getText().trim().isEmpty())) { ErrorLabel.setText(taal[93]);//w w w .j ava 2 s.c o m ErrorLabel.setVisible(true); } else { String dateFromInput = dateFrom.getText(); String dateToInput = dateTo.getText(); //Doe dit alleen wanneer er waardes zijn ingevuld. lineChart.setAnimated(false); pieChart.setAnimated(false); //PIECHART //Maak alle data en aantallen weer leeg. int luggage = 0, foundAmount = 0, lostAmount = 0, destroyAmount = 0, settleAmount = 0, neverFoundAmount = 0, depotAmount = 0; int jan = 0, feb = 0, mar = 0, apr = 0, mei = 0, jun = 0, jul = 0, aug = 0, sep = 0, okt = 0, nov = 0, dec = 0; total = 0; series.getData().clear(); pieChartData = FXCollections.observableArrayList(); //Krijg alle data voor de pietchart die tussen de periode van DateFrom en DateTo ligt. try { conn = fys.connectToDatabase(conn); stmt = conn.createStatement(); //connectToDatabase(conn, stmt, "test", "root", "root"); String sql = "SELECT status, date, COUNT(status) AS Count FROM bagagedatabase.luggage_status " + "WHERE date >= \"" + fys.convertToDutchDate(dateFromInput) + "\" " + "AND date <= \"" + fys.convertToDutchDate(dateToInput) + "\" " + "GROUP BY status"; //Voeg alle aantallen per status toe aan variabelen. try (ResultSet rs = stmt.executeQuery(sql)) { while (rs.next()) { luggage++; //Retrieve by column name foundAmount = (rs.getInt("status") == 0 ? rs.getInt("Count") : foundAmount); lostAmount = (rs.getInt("status") == 1 ? rs.getInt("Count") : lostAmount); destroyAmount = (rs.getInt("status") == 2 ? rs.getInt("Count") : destroyAmount); settleAmount = (rs.getInt("status") == 3 ? rs.getInt("Count") : settleAmount); neverFoundAmount = (rs.getInt("status") == 4 ? rs.getInt("Count") : neverFoundAmount); depotAmount = (rs.getInt("status") == 5 ? rs.getInt("Count") : depotAmount); } } } catch (SQLException ex) { // handle any errors System.out.println("SQLException: " + ex.getMessage()); System.out.println("SQLState: " + ex.getSQLState()); System.out.println("VendorError: " + ex.getErrorCode()); } //Voeg de waardes toe aan de array. pieChartData = FXCollections.observableArrayList(new PieChart.Data(ExportToPdfTexts[15], foundAmount), new PieChart.Data(ExportToPdfTexts[16], lostAmount), new PieChart.Data(ExportToPdfTexts[17], destroyAmount), new PieChart.Data(ExportToPdfTexts[18], settleAmount), new PieChart.Data(ExportToPdfTexts[19], neverFoundAmount), new PieChart.Data(ExportToPdfTexts[20], depotAmount)); //Update de titel pieChart.setTitle(ExportToPdfTexts[0]); //Update de piechart met de gevraagde gegevens. pieChart.setData(pieChartData); //Voor elke aantal tel ze met elkaar op en sla het op bij total. for (PieChart.Data d : pieChart.getData()) { total += d.getPieValue(); } //Verander de tekst van elke piechartdata. naar: (aantal statusnaam: percentage). pieChartData.forEach(data -> data.nameProperty().bind(Bindings.concat((int) data.getPieValue(), " ", data.getName(), ": ", (total == 0 || (int) data.getPieValue() == 0) ? 0 : (int) (data.getPieValue() / total * 100), "%"))); //LINECHART //Krijg alle data voor de linechart die tussen de periode van DateFrom en DateTo ligt. try { conn = fys.connectToDatabase(conn); stmt = conn.createStatement(); String sql = "SELECT date, COUNT(date) as Count FROM bagagedatabase.luggage_status " + "WHERE status = 6 AND date >= \"" + fys.convertToDutchDate(dateFromInput) + "\" " + "AND date <= \"" + fys.convertToDutchDate(dateToInput) + "\" " + "GROUP BY date"; ResultSet rs = stmt.executeQuery(sql); while (rs.next()) { //Retrieve by column name //Voeg alle aantallen per maand toe aan variabelen. if (rs.getString("date") != null) { //Krijg van elke date record de maand eruit. String str[] = rs.getString("date").split("-"); int month = Integer.parseInt(str[1]); jan = (month == 1 ? jan += rs.getInt("Count") : jan); feb = (month == 2 ? feb += rs.getInt("Count") : feb); mar = (month == 3 ? mar += rs.getInt("Count") : mar); apr = (month == 4 ? apr += rs.getInt("Count") : apr); mei = (month == 5 ? jan += rs.getInt("Count") : mei); jun = (month == 6 ? jun += rs.getInt("Count") : jun); jul = (month == 7 ? jul += rs.getInt("Count") : jul); aug = (month == 8 ? aug += rs.getInt("Count") : aug); sep = (month == 9 ? sep += rs.getInt("Count") : sep); okt = (month == 10 ? okt += rs.getInt("Count") : okt); nov = (month == 11 ? nov += rs.getInt("Count") : nov); dec = (month == 12 ? dec += rs.getInt("Count") : dec); } } rs.close(); conn.close(); } catch (SQLException ex) { // handle any errors System.out.println("SQLException: " + ex.getMessage()); System.out.println("SQLState: " + ex.getSQLState()); System.out.println("VendorError: " + ex.getErrorCode()); } //Update de titel lineChart.setTitle(ExportToPdfTexts[1]); //Update de linechart naar de waardes die gewenst is. series.setName(ExportToPdfTexts[2]); series.getData().add(new XYChart.Data<>(ExportToPdfTexts[3], jan)); series.getData().add(new XYChart.Data(ExportToPdfTexts[4], feb)); series.getData().add(new XYChart.Data<>(ExportToPdfTexts[5], mar)); series.getData().add(new XYChart.Data(ExportToPdfTexts[6], apr)); series.getData().add(new XYChart.Data<>(ExportToPdfTexts[7], mei)); series.getData().add(new XYChart.Data(ExportToPdfTexts[8], jun)); series.getData().add(new XYChart.Data<>(ExportToPdfTexts[9], jul)); series.getData().add(new XYChart.Data(ExportToPdfTexts[10], aug)); series.getData().add(new XYChart.Data<>(ExportToPdfTexts[11], sep)); series.getData().add(new XYChart.Data(ExportToPdfTexts[12], okt)); series.getData().add(new XYChart.Data<>(ExportToPdfTexts[13], nov)); series.getData().add(new XYChart.Data(ExportToPdfTexts[14], dec)); //Update de piechart en linechart voordat er een screenshot van genomen wordt. lineChart.applyCss(); lineChart.layout(); pieChart.applyCss(); pieChart.layout(); //Maak een screenshot van de piechart en linechart. savePieChartAsPng(); saveLineChartAsPng(); try { //Krijg de datum van vandaag voor pdf. DateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd"); Date date = new Date(); String dateString = dateFormat.format(date); //Krijg de content van de template pdf en maake nieuw pdf aan. File pdfdoc = new File("src/fys/templates/statisticstemplate.pdf"); PDDocument document = null; document = PDDocument.load(pdfdoc); PDAcroForm acroForm = document.getDocumentCatalog().getAcroForm(); List<PDField> fields = acroForm.getFields(); // set the text in the form-field <-- does work //Verander voor elk veld de waardes. for (PDField field : fields) { if (field.getFullyQualifiedName().equals("found")) { field.setValue(String.valueOf(foundAmount)); } if (field.getFullyQualifiedName().equals("lost")) { field.setValue(String.valueOf(lostAmount)); } if (field.getFullyQualifiedName().equals("destroyed")) { field.setValue(String.valueOf(destroyAmount)); } if (field.getFullyQualifiedName().equals("completed")) { field.setValue(String.valueOf(settleAmount)); } if (field.getFullyQualifiedName().equals("neverfound")) { field.setValue(String.valueOf(neverFoundAmount)); } if (field.getFullyQualifiedName().equals("depot")) { field.setValue(String.valueOf(depotAmount)); } if (field.getFullyQualifiedName().equals("jan")) { field.setValue(String.valueOf(jan)); } if (field.getFullyQualifiedName().equals("feb")) { field.setValue(String.valueOf(feb)); } if (field.getFullyQualifiedName().equals("mar")) { field.setValue(String.valueOf(mar)); } if (field.getFullyQualifiedName().equals("apr")) { field.setValue(String.valueOf(apr)); } if (field.getFullyQualifiedName().equals("may")) { field.setValue(String.valueOf(mei)); } if (field.getFullyQualifiedName().equals("jun")) { field.setValue(String.valueOf(jun)); } if (field.getFullyQualifiedName().equals("jul")) { field.setValue(String.valueOf(jul)); } if (field.getFullyQualifiedName().equals("aug")) { field.setValue(String.valueOf(aug)); } if (field.getFullyQualifiedName().equals("sep")) { field.setValue(String.valueOf(sep)); } if (field.getFullyQualifiedName().equals("oct")) { field.setValue(String.valueOf(okt)); } if (field.getFullyQualifiedName().equals("nov")) { field.setValue(String.valueOf(nov)); } if (field.getFullyQualifiedName().equals("dec")) { field.setValue(String.valueOf(dec)); } if (field.getFullyQualifiedName().equals("date")) { field.setValue(String.valueOf(dateString)); } if (field.getFullyQualifiedName().equals("period")) { field.setValue(String.valueOf(dateFromInput + " | " + dateToInput)); } } //Retrieving the page PDPage page = document.getPage(0); //Creating PDImageXObject object loginController login = new loginController(); PDImageXObject pieChartImage = PDImageXObject .createFromFile("src/fys/statistieken/PieChart_" + login.getUsersName() + ".png", document); PDImageXObject lineChartImage = PDImageXObject.createFromFile( "src/fys/statistieken/LineChart_" + login.getUsersName() + ".png", document); //creating the PDPageContentStream object PDPageContentStream contents = new PDPageContentStream(document, page, true, true, true); //Drawing the image in the PDF document contents.drawImage(pieChartImage, 75, 0, 350, 300); contents.drawImage(lineChartImage, 425, 0, 350, 300); //Closing the PDPageContentStream object contents.close(); //Sla het docment op. document.save("src/fys/statistieken/statistics" + dateFromInput + dateToInput + ".pdf"); document.close(); //Verwijder de plaatjes die waren opgeslagen. savePieChartAsPng().delete(); saveLineChartAsPng().delete(); //Sluit de popup home_pane.setDisable(false); pdfPane.setVisible(false); } catch (IOException ex) { Logger.getLogger(StatistiekenController.class.getName()).log(Level.SEVERE, null, ex); } } }
From source file:GUI.Helper.PDFIOHelper.java
private static void drawReportHeaderFooter(PDDocument report, Project proj, boolean headerOnFirstPage) { int pageIdx = headerOnFirstPage ? 0 : 1; int marginOffset = 10; try {/*w w w . j av a2s . c om*/ PDPageContentStream cs; for (int p = pageIdx; p < report.getNumberOfPages(); p++) { cs = new PDPageContentStream(report, report.getPage(p), true, false); cs.setFont(PDType1Font.TIMES_ROMAN, 11); cs.setNonStrokingColor(Color.BLACK); cs.beginText(); String dateString = DateFormat.getDateInstance(DateFormat.MEDIUM) .format(Calendar.getInstance().getTime()); cs.setTextMatrix(new Matrix(1, 0, 0, 1, MARGIN_LEFT_X, MARGIN_TOP_Y + marginOffset)); cs.showText(dateString); String projectString = "WZ ITS Tool Report: " + proj.getName(); cs.setTextMatrix(new Matrix(1, 0, 0, 1, MARGIN_RIGHT_X - (PDType1Font.TIMES_ROMAN.getStringWidth(projectString) / 1000 * 11), MARGIN_TOP_Y + marginOffset)); cs.showText(projectString); String pageNumString = "Page " + String.valueOf(p + 1) + " of " + String.valueOf(report.getNumberOfPages()); cs.setTextMatrix(new Matrix(1, 0, 0, 1, MARGIN_LEFT_X + (MARGIN_RIGHT_X - MARGIN_LEFT_X) / 2.0f - (PDType1Font.TIMES_ROMAN.getStringWidth(pageNumString) / 1000 * 11) / 2.0f, MARGIN_BOTTOM_Y - marginOffset)); cs.showText(pageNumString); cs.setTextMatrix(new Matrix(1, 0, 0, 1, MARGIN_LEFT_X + 20, MARGIN_BOTTOM_Y - marginOffset)); cs.showText("WZ ITS Tool V" + WZITS_FX.VERSION); String analystAgencyStr = (proj.getAnalyst() != null ? proj.getAnalyst() : "") + (proj.getAnalyst() != null && proj.getAgency() != null ? " / " : "") + (proj.getAgency() != null ? proj.getAgency() : ""); cs.setTextMatrix(new Matrix(1, 0, 0, 1, MARGIN_RIGHT_X - (PDType1Font.TIMES_ROMAN.getStringWidth(analystAgencyStr) / 1000 * 11), MARGIN_BOTTOM_Y - marginOffset)); cs.showText(analystAgencyStr); cs.endText(); BufferedImage logoWZITS = ImageIO.read(WZITS_FX.class.getResource("/GUI/Icon/wzits_icon_64.png")); //ColorConvertOp op = new ColorConvertOp(ColorSpace.getInstance(ColorSpace.CS_GRAY), null); //op.filter(logoWZITS, logoWZITS); cs.drawImage(LosslessFactory.createFromImage(report, logoWZITS), MARGIN_LEFT_X, MARGIN_BOTTOM_Y - marginOffset - 3, 16, 16); cs.close(); } } catch (IOException e) { System.out.println("Something went wrong"); } }
From source file:merge_split.MergeSplit.java
License:Apache License
private void MergeButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_MergeButtonActionPerformed try {//w w w .j a v a2 s .c om PDDocument samplePdf = new PDDocument(); ArrayList<PDDocument> list = new ArrayList<>(); for (int i = 0; i < dtm.getRowCount(); i++) { File file = new File((String) dtm.getValueAt(i, 0)); String code = (String) dtm.getValueAt(i, 3); PDDocument doc1; if (code.equals("ok")) { doc1 = PDDocument.load(file); } else { doc1 = PDDocument.load(file, code); } list.add(doc1); doc1.setAllSecurityToBeRemoved(true); TreeSet tree = findPages((String) dtm.getValueAt(i, 2)); for (int j = 0; j < doc1.getNumberOfPages(); j++) { if (tree.contains(j + 1)) { samplePdf.addPage(doc1.getPage(j)); } } } System.out.println("Number:" + samplePdf.getNumberOfPages()); String destination = jTextField1.getText() + "\\" + jTextField2.getText() + ".pdf"; PDDocumentInformation info = samplePdf.getDocumentInformation(); info.setAuthor(jTextField3.getText()); File output = new File(destination); samplePdf.save(output); samplePdf.close(); for (int i = 0; i < list.size(); i++) { list.get(i).close(); } } catch (IOException ex) { JOptionPane.showMessageDialog(null, "Your input is incorrect. Please fill all the fields.", "Input warning", JOptionPane.WARNING_MESSAGE); } }
From source file:merge_split.MergeSplit.java
License:Apache License
private void RotateButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_RotateButtonActionPerformed try {/* w w w . j a va 2 s . com*/ PDDocument samplePdf = new PDDocument(); File file = new File(RotateFileField.getText()); PDDocument doc1; if (rotatecode.equals("ok")) { doc1 = PDDocument.load(file); } else { doc1 = PDDocument.load(file, rotatecode); } doc1.setAllSecurityToBeRemoved(true); TreeSet tree = findPages(RotatePagesField.getText()); for (int j = 0; j < doc1.getNumberOfPages(); j++) { PDPage page = doc1.getPage(j); if (tree.contains(j + 1)) { if (Rotate90.isSelected()) { page.setRotation(90); samplePdf.addPage(page); } else if (Rotate180.isSelected()) { page.setRotation(180); samplePdf.addPage(page); } else if (Rotate270.isSelected()) { page.setRotation(270); samplePdf.addPage(page); } } else { samplePdf.addPage(page); } } System.out.println("Number:" + samplePdf.getNumberOfPages()); String destination = RotateDestinationField.getText() + "\\" + RotateNameField.getText() + ".pdf"; PDDocumentInformation info = samplePdf.getDocumentInformation(); info.setAuthor(RotateAuthorField.getText()); File output = new File(destination); samplePdf.save(output); samplePdf.close(); } catch (IOException ex) { Logger.getLogger(MergeSplit.class.getName()).log(Level.SEVERE, null, ex); JOptionPane.showMessageDialog(null, "Your input is incorrect. Please fill all the fields.", "Input warning", JOptionPane.WARNING_MESSAGE); } }