Пример #1
0
  /** @param helpAddress */
  public OpenHelpUrl(String helpAddress) {

    if (!java.awt.Desktop.isDesktopSupported()) {

      System.err.println("Desktop is not supported (fatal)");
      System.exit(1);
    }

    java.awt.Desktop desktop = java.awt.Desktop.getDesktop();

    if (!desktop.isSupported(java.awt.Desktop.Action.BROWSE)) {

      System.err.println("Desktop doesn't support the browse action (fatal)");
      System.exit(1);
    }

    try {

      java.net.URI uri = new java.net.URI(helpAddress);
      desktop.browse(uri);
    } catch (Exception e) {

      System.err.println(e.getMessage());
    }
  }
  // eventMenuPopup ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  private void eventMenuPopup() {

    try {

      URI uri = new URI(Data.WIKI_URL + underscoreName(getWikiTopic()));
      Desktop desktop = null;
      if (Desktop.isDesktopSupported()) {
        desktop = Desktop.getDesktop();
      } // if

      if (desktop != null) {
        desktop.browse(uri);
      } // if

    } // try
    catch (IOException error) {
      JOptionPane.showMessageDialog(
          Data.getView(),
          "^Wiki Error: " + error.getMessage(),
          "Wiki Error: " + Data.APP_TITLE,
          JOptionPane.ERROR_MESSAGE);
    } // catch
    catch (URISyntaxException error) {
      JOptionPane.showMessageDialog(
          Data.getView(),
          "@Wiki Error: " + error.getMessage(),
          "Wiki Error: " + Data.APP_TITLE,
          JOptionPane.ERROR_MESSAGE);
    } // catch
  } // eventMenuPopup ----------------------------------------------------------
Пример #3
0
  private static void openBrowser(OAuthV1 oAuth) {

    String authorizationUrl = OAuthV1Client.generateAuthorizationURL(oAuth);

    System.out.println("Get verification code......");
    if (!java.awt.Desktop.isDesktopSupported()) {

      System.err.println("Desktop is not supported (fatal)");
      System.exit(1);
    }
    java.awt.Desktop desktop = java.awt.Desktop.getDesktop();
    if (desktop == null || !desktop.isSupported(java.awt.Desktop.Action.BROWSE)) {

      System.err.println("Desktop doesn't support the browse action (fatal)");
      System.exit(1);
    }
    try {
      desktop.browse(new URI(authorizationUrl));
    } catch (IOException e) {
      e.printStackTrace();
      System.exit(1);
    } catch (URISyntaxException e) {
      e.printStackTrace();
      System.exit(1);
    }
  }
Пример #4
0
 /**
  * 抓屏方法
  *
  * @see 该方法抓的是全屏,并且当传入的fileName参数为空时会将抓屏图片默认保存到用户桌面上
  * @param fileName 抓屏后的图片保存名称(含保存路径及后缀),传空时会把图片自动保存到桌面
  * @param isAutoOpenImage 是否自动打开图片
  * @return 抓屏成功返回true,反之false
  */
 public static boolean captureScreen(String fileName, boolean isAutoOpenImage) {
   if (isEmpty(fileName)) {
     String desktop = FileSystemView.getFileSystemView().getHomeDirectory().getPath();
     String separator = System.getProperty("file.separator");
     String imageName = "截屏_" + new SimpleDateFormat("yyyyMMddHHmmss").format(new Date()) + ".png";
     fileName = desktop + separator + imageName;
   }
   String fileSuffix = fileName.substring(fileName.lastIndexOf(".") + 1);
   File file = new File(fileName);
   // 获取屏幕大小
   Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();
   Rectangle screenRectangle = new Rectangle(screenSize);
   try {
     Robot robot = new Robot();
     BufferedImage image = robot.createScreenCapture(screenRectangle);
     ImageIO.write(image, fileSuffix, file);
     // 自动打开图片
     if (isAutoOpenImage) {
       if (Desktop.isDesktopSupported() && Desktop.getDesktop().isSupported(Desktop.Action.OPEN)) {
         Desktop.getDesktop().open(file);
       }
     }
   } catch (AWTException e) {
     return false;
   } catch (IOException e) {
     return false;
   }
   return true;
 }
Пример #5
0
  @Override
  protected final void doExecute(Application app) {
    if (Desktop.isDesktopSupported()) {
      Desktop desktop = Desktop.getDesktop();
      if (desktop.isSupported(getType())) {
        try {
          switch (getType()) {
            case BROWSE:
              desktop.browse(getURI(app));
              return;
            case MAIL:
              desktop.mail(getURI(app));
              return;
          }
        } catch (Exception e) {
          getLog().error("Invalid URI", e);
        }
      }
    }

    JOptionPane.showMessageDialog(
        app.getAppFrame(),
        String.format("Action %s is not supported", getType()),
        "",
        JOptionPane.WARNING_MESSAGE);
  }
 private void prepareMailAll() {
   // TODO Auto-generated method stub
   String list = "";
   for (DimensionsUser user : users) {
     //					list += user.getUserId()+"@ac.bankit.it";
     list += user.getUserId();
     list += ";";
   }
   GestConfFrame.getInstance().cmdOutAppend("\n" + list);
   Desktop desktop;
   if (Desktop.isDesktopSupported()
       && (desktop = Desktop.getDesktop()).isSupported(Desktop.Action.MAIL)) {
     URI mailto = null;
     try {
       mailto = new URI("mailto:" + list + "?subject=Hello%20World");
     } catch (URISyntaxException e) {
       // TODO Auto-generated catch block
       e.printStackTrace();
     }
     try {
       desktop.mail(mailto);
     } catch (IOException e) {
       // TODO Auto-generated catch block
       e.printStackTrace();
     }
   } else {
     // TODO fallback to some Runtime.exec(..) voodoo?
     throw new RuntimeException("desktop doesn't support mailto; mail is dead anyway ;)");
   }
   setVisible(false);
 }
Пример #7
0
  private void facebookConnect() throws FacebookException {
    // auth.createToken returns a string
    // http://wiki.developers.facebook.com/index.php/Auth.createToken
    facebookAuthToken = facebookClient.executeQuery("auth.createToken", String.class);
    String url =
        "http://www.facebook.com/login.php"
            + "?api_key="
            + FACEBOOK_API_KEY
            + "&fbconnect=true"
            + "&v=1.0"
            + "&connect_display=page"
            + "&session_key_only=true"
            + "&req_perms=read_stream,publish_stream,offline_access"
            + "&auth_token="
            + facebookAuthToken;

    // Here we launch a browser with the above URL so the user can login to Facebook, grant our
    // requested permissions and send our token for pickup later
    if (Desktop.isDesktopSupported()) {
      Desktop desktop = Desktop.getDesktop();

      if (desktop.isSupported(Desktop.Action.BROWSE)) {
        try {
          desktop.browse(new URI(url));
        } catch (IOException ioe) {
          ioe.printStackTrace();
        } catch (URISyntaxException use) {
          use.printStackTrace();
        }
      }
    }
  }
Пример #8
0
 @Override
 public void mousePressed(MouseEvent me) {
   JTable table = (JTable) me.getSource();
   Point p = me.getPoint();
   int row = table.rowAtPoint(p);
   if (me.getClickCount() == 2) {
     int fila = grid.getSelectedRow();
     System.out.println("Seleccionada " + grid.getSelectedRow());
     if (grid.getModel().getValueAt(fila, 1) != null) {
       String openFile = grid.getModel().getValueAt(fila, 1).toString();
       System.out.println("Abrir:" + openFile);
       if (new File(openFile).exists()) {
         if (Desktop.isDesktopSupported()) {
           try {
             File myFile = new File(openFile);
             Desktop.getDesktop().open(myFile);
           } catch (IOException ex) {
             JOptionPane.showMessageDialog(
                 SiSeOnFrame.this,
                 "No fue posible abrir el archivo.",
                 "Archivo no encontrado o dañado.",
                 JOptionPane.WARNING_MESSAGE);
           }
         } else {
           System.out.println("DESKTOP NO SOPORTADO");
         } // if
       } else {
         JOptionPane.showMessageDialog(
             SiSeOnFrame.this, "El archivo ya no se encuentra en la ruta donde fue indexado.");
       }
     }
   }
 }
Пример #9
0
  public HyberLinkLabel(String text, String url) {
    this.text = text;
    this.url = url;
    try {
      this.isSupported =
          Desktop.isDesktopSupported() && Desktop.getDesktop().isSupported(Desktop.Action.BROWSE);
    } catch (Exception e) {
      System.out.println("Browse is not supported");
      this.isSupported = false;
    }
    setActive(false);
    addMouseListener(
        new MouseAdapter() {
          public void mouseEntered(MouseEvent e) {
            setActive(isSupported);
            if (isSupported) setCursor(new Cursor(Cursor.HAND_CURSOR));
          }

          public void mouseExited(MouseEvent e) {
            setActive(false);
          }

          public void mouseClicked(MouseEvent e) {
            try {
              Desktop.getDesktop().browse(new java.net.URI(HyberLinkLabel.this.url));
            } catch (Exception ex) {
              System.out.println(ex.toString());
            }
          }
        });
  }
  /**
   * @param he hiperlik Event.
   * @see
   *     javax.help.plaf.basic.BasicContentViewerUI#hyperlinkUpdate(javax.swing.event.HyperlinkEvent)
   */
  @Override
  public void hyperlinkUpdate(final HyperlinkEvent he) {

    if (he.getEventType() == HyperlinkEvent.EventType.ACTIVATED) {
      URL u = he.getURL();
      if ("mailto".equalsIgnoreCase(u.getProtocol())
          || "http".equalsIgnoreCase(u.getProtocol())
          || "ftp".equalsIgnoreCase(u.getProtocol())) {
        Desktop desktop = null;
        if (Desktop.isDesktopSupported()) {
          desktop = Desktop.getDesktop();
          if (desktop.isSupported(Desktop.Action.BROWSE)) {
            try {
              desktop.browse(u.toURI());
            } catch (MalformedURLException e1) {
              DialogUtils.showGeneralErrorDialog(
                  new Frame(), "MalformedURLException", "Invalid URL.");
            } catch (IOException e1) {
              DialogUtils.showGeneralErrorDialog(new Frame(), "IOException", "Resource not found.");
            } catch (URISyntaxException uriSyntaxEx) {
              DialogUtils.showGeneralErrorDialog(new Frame(), "URISyntaxException", "Invalid URI.");
            }
          }
        }
      } else {
        super.hyperlinkUpdate(he);
      }
    }
  }
Пример #11
0
  public static void openURL(String url) {

    try {
      // Since Java6 this is a much easier method to open the browser
      if (Desktop.isDesktopSupported()) {
        Desktop desktop = Desktop.getDesktop();
        desktop.browse(new URI(url));
      }

      // Only if desktop is not supported we try the old main specific code
      else {
        if (SystemInfo.OS == Os.MAC) {
          Class<?> fileMgr = Class.forName("com.apple.eio.FileManager");
          Method openURL = fileMgr.getDeclaredMethod("openURL", new Class[] {String.class});
          openURL.invoke(null, new Object[] {url});
        } else if (SystemInfo.OS == Os.WINDOWS)
          Runtime.getRuntime().exec("rundll32 url.dll,FileProtocolHandler " + url);
        else { // assume Unix or Linux
          String[] browsers = {"firefox", "opera", "konqueror", "epiphany", "mozilla", "netscape"};
          String browser = null;
          for (int count = 0; (count < browsers.length) && (browser == null); count++)
            if (Runtime.getRuntime().exec(new String[] {"which", browsers[count]}).waitFor() == 0)
              browser = browsers[count];
          if (browser == null) throw new Exception("Could not find web browser");
          else Runtime.getRuntime().exec(new String[] {browser, url});
        }
      }
    } catch (Exception e) {
      log.error("Error at opening the URL.", e);
    }
  }
Пример #12
0
  public static void main(String[] args) {

    if (!java.awt.Desktop.isDesktopSupported()) {

      System.err.println("Desktop is not supported (fatal)");
      System.exit(1);
    }

    java.awt.Desktop desktop = java.awt.Desktop.getDesktop();

    if (!desktop.isSupported(java.awt.Desktop.Action.BROWSE)) {

      System.err.println("Desktop doesn't support the browse action (fatal)");
      System.exit(1);
    }

    try {

      java.net.URI uri = new java.net.URI("http://www.d3js.org");
      desktop.browse(uri);
    } catch (Exception e) {

      System.err.println(e.getMessage());
    }
  }
Пример #13
0
 /**
  * Opens the default mail application.
  *
  * @throws IOException
  * @since 0.7.0
  */
 public static void mail() throws IOException { // $JUnit$
   if (log.isDebugEnabled()) log.debug(HelperLog.methodStart());
   if (Desktop.isDesktopSupported()) {
     Desktop.getDesktop().mail();
   } else {
     throw new RuntimeException("Mail application not supported by your machine"); // $NON-NLS-1$
   }
   if (log.isDebugEnabled()) log.debug(HelperLog.methodExit());
 }
 private void openContentDirectory() {
   try {
     if (Desktop.isDesktopSupported()) {
       Desktop.getDesktop().open(new File(ForgeConstants.CACHE_DIR));
     }
   } catch (final Exception e) {
     System.out.println("Unable to open Directory: " + e.toString());
   }
 }
Пример #15
0
  private JMenu createHelpMenu() {

    List<JComponent> menuItems = new ArrayList<JComponent>();

    MenuAction menuAction = null;

    menuAction =
        new MenuAction("User Guide ... ") {

          @Override
          public void actionPerformed(ActionEvent e) {
            try {
              BrowserLauncher.openURL(SERVER_BASE_URL + "igv/UserGuide");
            } catch (IOException ex) {
              log.error("Error opening browser", ex);
            }
          }
        };
    menuAction.setToolTipText(HELP_TOOLTIP);
    menuItems.add(MenuAndToolbarUtils.createMenuItem(menuAction));

    if (Desktop.isDesktopSupported()) {
      final Desktop desktop = Desktop.getDesktop();
      if (desktop.isSupported(Desktop.Action.MAIL)) {

        menuAction =
            new MenuAction("Help Forum...") {

              @Override
              public void actionPerformed(ActionEvent e) {
                try {
                  URI uri = new URI("http://groups.google.com/forum/#!forum/igv-help");
                  Desktop.getDesktop().browse(uri);
                } catch (Exception ex) {
                  log.error("Error opening igv-help uri", ex);
                }
              }
            };
        menuAction.setToolTipText("Email support");
        menuItems.add(MenuAndToolbarUtils.createMenuItem(menuAction));
      }
    }

    menuAction =
        new MenuAction("About IGV ") {

          @Override
          public void actionPerformed(ActionEvent e) {
            (new AboutDialog(IGV.getMainFrame(), true)).setVisible(true);
          }
        };
    menuAction.setToolTipText(ABOUT_TOOLTIP);
    menuItems.add(MenuAndToolbarUtils.createMenuItem(menuAction));

    MenuAction helpMenuAction = new MenuAction("Help");
    return MenuAndToolbarUtils.createMenu(menuItems, helpMenuAction);
  }
Пример #16
0
 public static void filmAbspielen(Frame parent, String datei) {
   boolean gut = false;
   File sFile;
   if (datei.isEmpty()) {
     return;
   }
   sFile = new File(datei);
   if (!sFile.exists()) {
     MVMessageDialog.showMessageDialog(
         parent, "Film existiert noch nicht!", "Fehler", JOptionPane.ERROR_MESSAGE);
     return;
   }
   try {
     if (!MVConfig.get(MVConfig.Configs.SYSTEM_PLAYER_ABSPIELEN).isEmpty()) {
       String programm = MVConfig.get(MVConfig.Configs.SYSTEM_PLAYER_ABSPIELEN);
       String[] cmd = {programm, sFile.getAbsolutePath()};
       Runtime.getRuntime().exec(cmd);
       gut = true;
     } else {
       if (Desktop.isDesktopSupported()) {
         Desktop d = Desktop.getDesktop();
         if (d.isSupported(Desktop.Action.OPEN)) {
           d.open(sFile);
           gut = true;
         }
       }
     }
   } catch (Exception ex) {
     try {
       gut = false;
       String programm = "";
       String text =
           "\n Ein Videoplayer zum Abspielen wird nicht gefunden.\n Videoplayer selbst auswählen.";
       DialogProgrammOrdnerOeffnen dialog =
           new DialogProgrammOrdnerOeffnen(parent, true, "", "Videoplayer suchen", text);
       dialog.setVisible(true);
       if (dialog.ok) {
         programm = dialog.ziel;
       }
       String[] cmd = {programm, sFile.getAbsolutePath()};
       Runtime.getRuntime().exec(cmd);
       MVConfig.add(MVConfig.Configs.SYSTEM_PLAYER_ABSPIELEN, programm);
       Listener.notify(Listener.EREIGNIS_PROGRAMM_OEFFNEN, GuiDownloads.class.getSimpleName());
       gut = true;
     } catch (Exception eex) {
       Log.errorLog(959632369, ex, "Ordner öffnen: " + datei);
     }
   } finally {
     if (!gut) {
       MVConfig.add(MVConfig.Configs.SYSTEM_PLAYER_ABSPIELEN, "");
       Listener.notify(Listener.EREIGNIS_PROGRAMM_OEFFNEN, GuiDownloads.class.getSimpleName());
       MVMessageDialog.showMessageDialog(
           parent, "Kann den Videoplayer nicht öffnen!", "Fehler", JOptionPane.ERROR_MESSAGE);
     }
   }
 }
Пример #17
0
 private static void openWebpage(URI uri) {
   Desktop desktop = Desktop.isDesktopSupported() ? Desktop.getDesktop() : null;
   if (desktop != null && desktop.isSupported(Desktop.Action.BROWSE)) {
     try {
       desktop.browse(uri);
     } catch (Exception e) {
       e.printStackTrace();
     }
   }
 }
Пример #18
0
 @Override
 public void actionPerformed(ActionEvent evt) {
   if (Desktop.isDesktopSupported()) {
     try {
       URI uri = new URI(evt.getActionCommand());
       Desktop.getDesktop().browse(uri);
     } catch (Exception e) {
     }
   }
 }
  public static void openUrl(final String url) throws IOException, URISyntaxException {
    if (java.awt.Desktop.isDesktopSupported()) {
      final java.awt.Desktop desktop = java.awt.Desktop.getDesktop();

      if (desktop.isSupported(java.awt.Desktop.Action.BROWSE)) {
        final java.net.URI uri = new java.net.URI(url);
        desktop.browse(uri);
      }
    }
  }
 @Override
 public void actionPerformed(ActionEvent ae) {
   if (ae.getSource().equals(openItem)) {
     File f = null;
     if (null == (f = SpeedyGrader.getInstance().getFilesLoc())) {
       f = new File(System.getProperty("user.home"));
     }
     JFileChooser chooser = new JFileChooser(f);
     chooser.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY);
     int ret = chooser.showOpenDialog(this);
     if (ret == JFileChooser.APPROVE_OPTION) {
       newFolderSelected(chooser.getSelectedFile());
     }
   } else if (ae.getSource().equals(inputItem)) {
     new InputDialog();
   } else if (ae.getSource().equals(saveItem)) {
     for (EditorPanel ep : editorPanels) {
       ep.save();
     }
     SpeedyGrader.getInstance().startComplieAndRun();
   } else if (ae.getSource().equals(refreshItem)) {
     newFolderSelected(null);
   } else if (ae.getSource().equals(githubItem)) {
     String url = "https://github.com/MitchellSlavik/SpeedyGrader";
     Desktop d = Desktop.isDesktopSupported() ? Desktop.getDesktop() : null;
     if (d != null && d.isSupported(Action.BROWSE)) {
       try {
         d.browse(URI.create(url));
       } catch (IOException e) {
         e.printStackTrace();
       }
     } else {
       JOptionPane.showMessageDialog(
           this,
           "We were unable to open a web browser. The url has been copied to your clipboard.",
           "Unable to preform operation",
           JOptionPane.ERROR_MESSAGE);
       StringSelection selection = new StringSelection(url);
       Clipboard clipboard = Toolkit.getDefaultToolkit().getSystemClipboard();
       clipboard.setContents(selection, selection);
     }
   } else if (ae.getSource().equals(aboutItem)) {
     new AboutDialog();
   } else if (ae.getSource().equals(installItem)) {
     new InstallDialog();
   } else if (ae.getSource().equals(upgradeItem)) {
     new AutoUpdater();
   } else if (ae.getSource().equals(editorSplitToggle)) {
     splitEditorPane.setOrientation(
         editorSplitToggle.isSelected() ? JSplitPane.VERTICAL_SPLIT : JSplitPane.HORIZONTAL_SPLIT);
     this.validate();
     this.repaint();
   }
 }
Пример #21
0
  public void openURI(String uri) {
    if (!Desktop.isDesktopSupported()) return;

    Desktop desktop = Desktop.getDesktop();
    if (!desktop.isSupported(Desktop.Action.BROWSE)) return;

    try {
      desktop.browse(new URI(uri));
    } catch (Exception ex) {
      throw new GdxRuntimeException(ex);
    }
  }
Пример #22
0
 public void openInBrowser(URI uri) {
   Desktop desktop = Desktop.isDesktopSupported() ? Desktop.getDesktop() : null;
   if (desktop != null && desktop.isSupported(Desktop.Action.BROWSE)) {
     try {
       desktop.browse(uri);
     } catch (IOException e) {
       System.err.println(e.getMessage());
     }
   } else {
     System.err.println("Desktop not supported, cannout open browser");
   }
 }
Пример #23
0
 /**
  * Attempts to open the default web browser to the given URL.
  *
  * @param url The URL to open
  * @throws IOException If the web browser could not be located or does not run
  */
 public static void openURL(String url) throws IOException {
   if (!(Desktop.isDesktopSupported()
       && Desktop.getDesktop().isSupported(Desktop.Action.BROWSE))) {
     openURL_old(url);
   } else {
     try {
       Desktop.getDesktop().browse(new URI(url));
     } catch (URISyntaxException e) {
       log.error("Error opening url " + url, e);
     }
   }
 }
Пример #24
0
 @Override
 public void hyperlinkUpdate(HyperlinkEvent e) {
   if (e.getEventType() == HyperlinkEvent.EventType.ACTIVATED) {
     if (java.awt.Desktop.isDesktopSupported()) {
       try {
         java.awt.Desktop.getDesktop().browse(e.getURL().toURI());
       } catch (Exception ex) {
         log.error("Error opening URL in browser:" + e.getURL());
       }
     }
   }
 }
Пример #25
0
  @Override
  public void mouseClicked(MouseEvent e) {
    Desktop desktop = Desktop.isDesktopSupported() ? Desktop.getDesktop() : null;

    if (desktop != null && desktop.isSupported(Desktop.Action.BROWSE)) {
      try {
        desktop.browse(url.toURI());
      } catch (IOException | URISyntaxException exc) {
        Logger.getLogger(AbreNavegador.class.getName()).log(Level.SEVERE, null, exc);
      }
    }
  }
Пример #26
0
 private void openBrowser() {
   if (!Desktop.isDesktopSupported()) {
     logger.warn(
         "Java Desktop class not supported on this platform.  Please open %s in your browser",
         uri.toString());
   }
   try {
     Desktop.getDesktop().browse(uri);
   } catch (IOException e) {
     throw new RuntimeException(e);
   }
 }
Пример #27
0
 @Override
 public void act(int button, boolean ctrl, boolean shft) {
   if (button == 1) {
     if (Desktop.isDesktopSupported()) {
       try {
         Desktop.getDesktop().browse(new URI(url));
       } catch (Exception e) {
         ALS.alDebugPrint("Desktop exception...");
       }
     }
   }
 }
 private void openErrorMessage(final String url) {
   Desktop desktop = Desktop.getDesktop();
   if ((Desktop.isDesktopSupported()) && (desktop.isSupported(Desktop.Action.BROWSE))) {
     try {
       URI uri = new URI(url);
       desktop.browse(uri);
     } catch (URISyntaxException e) {
       e.printStackTrace();
     } catch (IOException e) {
       e.printStackTrace();
     }
   }
 }
Пример #29
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);
   }
 }
Пример #30
0
 /* (non-Javadoc)
  * @see java.awt.event.ActionListener#actionPerformed(java.awt.event.ActionEvent)
  */
 @Override
 public void actionPerformed(ActionEvent arg0) {
   Desktop desktop = Desktop.getDesktop();
   if (Desktop.isDesktopSupported() && desktop.isSupported(Desktop.Action.BROWSE)) {
     try {
       desktop.browse(new URI("http://blog.sina.com.cn/kkliuyao"));
     } catch (IOException e) {
       e.printStackTrace();
     } catch (URISyntaxException e) {
       e.printStackTrace();
     }
   }
 }