Example #1
0
 public void showPage(int pageNumber) {
   int visadsida = pageNumber + 1; // AH* nytillagt.
   try {
     SkrivUt(4, "ShowPage i PDFReader.");
     currentPage = pageNumber; // AH* TIllagd för att hålla reda på akt sida.
     PageWrapper wrapper = new PageWrapper(this);
     wrapper.displayPage((PDPage) pages.get(pageNumber));
     // if (EasyReader) cogsumsim.setDocumentPanel( wrapper.getPanel()); //AH*
     // PageWrapper cswrapper = new PageWrapper(cogsumsim.easyreader); AH*
     // cogsumsim.wrapper.displayPage( (PDPage)pages.get(pageNumber) ); //AH*
     if (documentPanel.getComponentCount() > 0) {
       documentPanel.remove(0);
       if (EasyReader) // AH* tillagt.
       cogsumsim.getDocumentPanel().remove(0);
     }
     documentPanel.add(wrapper.getPanel());
     if (EasyReader) // AH* tillagt.
     {
       cogsumsim.setDocumentPanel(documentPanel);
       // cogsumsim.getDocumentPanel().;
     }
     pack();
     sumPan.Sidantal.setText("" + visadsida + " Av " + numberOfPages); // AH* nytt.
   } catch (IOException exception) {
     exception.printStackTrace();
   }
 }
Example #2
0
 public void previousPage() {
   if (currentPage > 0) {
     int currtemp = currentPage;
     currentPage--;
     sumPan.Sidantal.setText("" + currtemp + " Av " + numberOfPages);
     // updateTitle(); // AH* Borttagen i senare.
     showPage(currentPage);
   }
 }
Example #3
0
 public void nextPage() {
   if (currentPage < numberOfPages - 1) {
     currentPage++;
     int currtemp = currentPage + 1;
     sumPan.Sidantal.setText("" + currtemp + " Av " + numberOfPages);
     // updateTitle(); // AH* Borttagen i senare.
     showPage(currentPage);
   }
 }
Example #4
0
 private void openPDFFile(String file) throws Exception {
   if (document != null) {
     document.close();
     documentPanel.removeAll();
   }
   InputStream input = null;
   File f = new File(file);
   input = new FileInputStream(f);
   document = parseDocument(input);
   pages = document.getDocumentCatalog().getAllPages();
   numberOfPages = pages.size();
   // AH* Sidantal till GUI:
   sumPan.Sidantal.setText("" + 1 + " Av " + numberOfPages);
   sumPan.sidnrantal = numberOfPages;
   currentFilename = f.getAbsolutePath(); // AH* Borttagen i senare version.
   currentPage = 0;
   updateTitle();
   showPage(0);
 }