use of org.apache.pdfbox.debugger.ui.FileOpenSaveDialog in project pdfbox by apache.
the class PDFDebugger method openMenuItemActionPerformed.
private void openMenuItemActionPerformed(ActionEvent evt) {
try {
if (IS_MAC_OS) {
FileDialog openDialog = new FileDialog(this, "Open");
openDialog.setFilenameFilter(new FilenameFilter() {
@Override
public boolean accept(File dir, String name) {
return name.toLowerCase().endsWith(".pdf");
}
});
openDialog.setVisible(true);
if (openDialog.getFile() != null) {
readPDFFile(openDialog.getFile(), "");
}
} else {
String[] extensions = new String[] { "pdf", "PDF" };
FileFilter pdfFilter = new ExtensionFileFilter(extensions, "PDF Files (*.pdf)");
FileOpenSaveDialog openDialog = new FileOpenSaveDialog(this, pdfFilter);
File file = openDialog.openFile();
if (file != null) {
readPDFFile(file, "");
}
}
} catch (IOException e) {
throw new RuntimeException(e);
}
}
Aggregations