Exemplo n.º 1
0
 @Override
 public void actionPerformed(ActionEvent e) {
   if (e.getSource().equals(this.browseButton)) {
     openFileChooser();
   } else if (e.getSource().equals(this.startExtractionButton)) {
     startExtraction();
   } else if (e.getSource().equals(this.openRootDirectoryButton)) {
     Desktop desktop = Desktop.getDesktop();
     try {
       desktop.open(EmojiTools.getRootDirectory());
     } catch (IOException e1) {
       EmojiTools.submitError(Thread.currentThread(), e1);
     }
   }
 }
Exemplo n.º 2
0
 // OVERLOAD OVERLOAD OVERLOAD :((((((((((((
 public void openFile(String entry) {
   try {
     String targetPath = currentPath + "\\" + entry;
     File file = new File(targetPath);
     if (!file.exists()) {
       System.out.println("Fisierul nu exista");
       return;
     }
     Desktop dk = Desktop.getDesktop();
     // Open a file
     dk.open(file);
   } catch (Exception e) {
   } finally {
     takePath();
   }
 }
  /**
   * Genera un pdf che contiene la lista di tutti gli studenti iscritti ad un appello
   *
   * @param pAppello informazioni appello
   * @throws Exception
   */
  public void createDocument(Appello pAppello) throws Exception {
    Document document = new Document();
    ArrayList<StudenteClass> listaIscritti = mDBMSStampaIscrittiBnd.getIscrittiAppello(pAppello);
    try {
      PdfWriter writer =
          PdfWriter.getInstance(
              document, new FileOutputStream("Elenco" + pAppello.getIdAppello() + ".pdf"));
      document.open();
      document.add(new Paragraph("Lista Iscritti"));

      // Add ordered list
      List orderedList = new List(List.ORDERED);
      for (StudenteClass s : listaIscritti) orderedList.add(new ListItem(s.toString()));

      document.add(orderedList);
      document.close();
      writer.close();

      Desktop d = Desktop.getDesktop();
      d.open(new File("Elenco" + pAppello.getIdAppello() + ".pdf"));
    } catch (Exception e) {
      e.printStackTrace();
    }
  }