Пример #1
0
 private void browseButton_actionPerformed(ActionEvent e) {
   if (logger.isInfoEnabled()) {
     logger.info("browse button clicked");
   }
   try {
     String urlString = urlTextField.getText();
     if (urlString == null || urlString.trim().length() == 0) {
       throw new MalformedURLException("You must specify a url.");
     }
     new URL(urlString); // may throw MalformedURLException
     BrowserLauncherErrorHandler errorHandler = new TestAppErrorHandler(debugTextArea);
     // use browser list if browserListField has data
     String browserItems = browserListField.getText();
     if (browserItems != null && browserItems.length() > 0) {
       logger.debug("using browser list");
       String[] browserArray = browserItems.split("[ ]+");
       List browserList = Arrays.asList(browserArray);
       logger.debug(browserList.toString());
       launcher.openURLinBrowser(browserList, urlString);
     } else {
       String targetBrowser = browserBox.getSelectedItem().toString();
       logger.debug(targetBrowser);
       launcher.openURLinBrowser(targetBrowser, urlString);
     }
   } catch (Exception ex) {
     // capture exception
     BrowserLauncherTestApp.updateDebugTextArea(ex, debugTextArea);
     // show message to user
     JOptionPane.showMessageDialog(
         this, ex.getMessage(), "Error Message", JOptionPane.ERROR_MESSAGE);
   }
 }
Пример #2
0
 private void copyButton_actionPerformed(ActionEvent e) {
   if (logger.isInfoEnabled()) {
     logger.info("copy button clicked");
   }
   debugTextArea.selectAll();
   debugTextArea.copy();
   debugTextArea.select(0, 0);
 }