コード例 #1
0
 /**
  * Tries to open a URL in the Browser
  *
  * @param url The URL
  * @param shiftUrl The URL to open when Shift is held
  */
 public static void openBrowser(String url, String shiftUrl) {
   try {
     if (Desktop.isDesktopSupported()) {
       if (shiftUrl.equals(url) || KeyUtil.isShiftPressed()) {
         Desktop.getDesktop().browse(new URI(shiftUrl));
       } else {
         Desktop.getDesktop().browse(new URI(url));
       }
     }
   } catch (Exception e) {
     ModUtil.LOGGER.error("Something bad happened when trying to open a URL!", e);
   }
 }
コード例 #2
0
 public void onPressed() {
   if (this.assignedEntry != null) {
     if (KeyUtil.isShiftPressed()) {
       this.assignedEntry = null;
       this.assignedChapter = null;
       this.assignedPage = null;
       this.assignedPageInIndex = 1;
     } else {
       openIndexEntry(this.booklet, this.assignedEntry, this.assignedPageInIndex, true);
       openChapter(this.booklet, this.assignedChapter, this.assignedPage);
     }
   } else {
     if (this.booklet.currentIndexEntry != null) {
       this.assignedEntry = this.booklet.currentIndexEntry;
       this.assignedChapter = this.booklet.currentChapter;
       this.assignedPage = this.booklet.currentPage;
       this.assignedPageInIndex = this.booklet.pageOpenInIndex;
     }
   }
 }