类javax.swing.event.HyperlinkEvent源码实例Demo

下面列出了怎么用javax.swing.event.HyperlinkEvent的API类实例代码及写法,或者点击链接到github查看源代码。

源代码1 项目: mzmine3   文件: ResultsTextPane.java
public ResultsTextPane(StyledDocument doc) {
  super(doc);
  createStyles();
  setEditorKit(JTextPane.createEditorKitForContentType("text/html"));
  setEditable(false);
  addHyperlinkListener(new HyperlinkListener() {
    @Override
    public void hyperlinkUpdate(HyperlinkEvent e) {
      if (e.getEventType() == HyperlinkEvent.EventType.ACTIVATED) {
        if (Desktop.isDesktopSupported()) {
          try {
            Desktop.getDesktop().browse(e.getURL().toURI());
          } catch (IOException | URISyntaxException e1) {
            e1.printStackTrace();
          }
        }
      }
    }
  });
}
 
源代码2 项目: Robot-Overlord-App   文件: HTMLDialogBox.java
/**
 * Turns HTML into a clickable dialog text component.
 * @param html String of valid HTML.
 * @return a JTextComponent with the HTML inside.
 */
public JTextComponent createHyperlinkListenableJEditorPane(String html) {
	final JEditorPane bottomText = new JEditorPane();
	bottomText.setContentType("text/html");
	bottomText.setEditable(false);
	bottomText.setText(html);
	bottomText.setOpaque(false);
	final HyperlinkListener hyperlinkListener = new HyperlinkListener() {
		public void hyperlinkUpdate(HyperlinkEvent hyperlinkEvent) {
			if (hyperlinkEvent.getEventType() == HyperlinkEvent.EventType.ACTIVATED) {
				if (Desktop.isDesktopSupported()) {
					try {
						Desktop.getDesktop().browse(hyperlinkEvent.getURL().toURI());
					} catch (IOException | URISyntaxException exception) {
						// Auto-generated catch block
						exception.printStackTrace();
					}
				}

			}
		}
	};
	bottomText.addHyperlinkListener(hyperlinkListener);
	return bottomText;
}
 
protected MyEnvironmentVariablesDialog() {
  super(EnvironmentVariablesTextFieldWithBrowseButton.this, true);
  myEnvVariablesTable = new EnvVariablesTable();
  myEnvVariablesTable.setValues(convertToVariables(myData.getEnvs(), false));

  myUseDefaultCb.setSelected(isPassParentEnvs());
  myWholePanel.add(myEnvVariablesTable.getComponent(), BorderLayout.CENTER);
  JPanel useDefaultPanel = new JPanel(new BorderLayout());
  useDefaultPanel.add(myUseDefaultCb, BorderLayout.CENTER);
  HyperlinkLabel showLink = new HyperlinkLabel(ExecutionBundle.message("env.vars.show.system"));
  useDefaultPanel.add(showLink, BorderLayout.EAST);
  showLink.addHyperlinkListener(new HyperlinkListener() {
    @Override
    public void hyperlinkUpdate(HyperlinkEvent e) {
      if (e.getEventType() == HyperlinkEvent.EventType.ACTIVATED) {
        showParentEnvironmentDialog(MyEnvironmentVariablesDialog.this.getWindow());
      }
    }
  });

  myWholePanel.add(useDefaultPanel, BorderLayout.SOUTH);
  setTitle(ExecutionBundle.message("environment.variables.dialog.title"));
  init();
}
 
源代码4 项目: consulo   文件: CtrlMouseHandler.java
@Override
public void hyperlinkUpdate(@Nonnull HyperlinkEvent e) {
  if (e.getEventType() != HyperlinkEvent.EventType.ACTIVATED) {
    return;
  }

  String description = e.getDescription();
  if (StringUtil.isEmpty(description) || !description.startsWith(DocumentationManagerProtocol.PSI_ELEMENT_PROTOCOL)) {
    return;
  }

  String elementName = e.getDescription().substring(DocumentationManagerProtocol.PSI_ELEMENT_PROTOCOL.length());

  DumbService.getInstance(myProject).withAlternativeResolveEnabled(() -> {
    PsiElement targetElement = myProvider.getDocumentationElementForLink(PsiManager.getInstance(myProject), elementName, myContext);
    if (targetElement != null) {
      LightweightHint hint = myHint;
      if (hint != null) {
        hint.hide(true);
      }
      DocumentationManager.getInstance(myProject).showJavaDocInfo(targetElement, myContext, null);
    }
  });
}
 
源代码5 项目: lizzie   文件: ConfigDialog.java
public LinkLabel(String text) {
  super("text/html", text);
  setEditable(false);
  setOpaque(false);
  putClientProperty(JEditorPane.HONOR_DISPLAY_PROPERTIES, Boolean.TRUE);
  addHyperlinkListener(
      new HyperlinkListener() {
        public void hyperlinkUpdate(HyperlinkEvent e) {
          if (HyperlinkEvent.EventType.ACTIVATED.equals(e.getEventType())) {
            if (Desktop.isDesktopSupported()) {
              try {
                Desktop.getDesktop().browse(e.getURL().toURI());
              } catch (Exception ex) {
              }
            }
          }
        }
      });
}
 
源代码6 项目: rapidminer-studio   文件: FixedWidthEditorPane.java
/**
 * Creates a pane with the given rootlessHTML as text with the given width.
 *
 * @param width
 *            the desired width
 * @param rootlessHTML
 *            the text, can contain hyperlinks that will be clickable
 */
public FixedWidthEditorPane(int width, String rootlessHTML) {
	super("text/html", "");
	this.width = width;
	this.rootlessHTML = rootlessHTML;
	updateLabel();

	setEditable(false);
	setFocusable(false);
	installDefaultStylesheet();
	addHyperlinkListener(new HyperlinkListener() {

		@Override
		public void hyperlinkUpdate(HyperlinkEvent e) {
			if (e.getEventType() == HyperlinkEvent.EventType.ACTIVATED) {
				RMUrlHandler.handleUrl(e.getDescription());
			}
		}
	});

}
 
源代码7 项目: netbeans   文件: DocumentationScrollPane.java
public void hyperlinkUpdate(HyperlinkEvent e) {
    if (e != null && HyperlinkEvent.EventType.ACTIVATED.equals(e.getEventType())) {
        final String desc = e.getDescription();
        if (desc != null) {
            RP.post(new Runnable() {
                public @Override void run() {
                    final ElementJavadoc cd;
                    synchronized (DocumentationScrollPane.this) {
                        cd = currentDocumentation;
                    }
                    if (cd != null) {
                        final ElementJavadoc doc = cd.resolveLink(desc);
                        if (doc != null) {
                            EventQueue.invokeLater(new Runnable() {
                                public @Override void run() {
                                    setData(doc, false);
                                }
                            });
                        }
                    }
                }
            });
        }
    }
}
 
源代码8 项目: netbeans   文件: BrowserUtils.java
public static HyperlinkListener createHyperlinkListener() {
    return new HyperlinkListener() {

        public void hyperlinkUpdate(HyperlinkEvent hlevt) {
            if (HyperlinkEvent.EventType.ACTIVATED == hlevt.getEventType()) {
                final URL url = hlevt.getURL();
                if (url != null) {
                    try {
                        openBrowser(url.toURI());
                    } catch (URISyntaxException e) {
                        LogManager.log(e);
                    }
                }
            }
        }
    };
}
 
源代码9 项目: EclipseCodeFormatter   文件: ProjectComponent.java
public void installOrUpdate(@NotNull Settings settings) {
	if (settings.isEnabled() && (settings.isEnableCppFormatting() || settings.isEnableJSFormatting() || settings.isEnableGWT())) {
		SwingUtilities.invokeLater(() -> Notifications.Bus.notify(
				GROUP_DISPLAY_ID_ERROR.createNotification(
						"Eclipse Code Formatter plugin", "Support for Cpp, JS, GWT formatting was dropped. Install an older version or <a href=\"#\">click here</a> to disable this warning.", NotificationType.WARNING, new NotificationListener() {
							@Override
							public void hyperlinkUpdate(@NotNull Notification notification, @NotNull HyperlinkEvent hyperlinkEvent) {
								settings.setEnableJSFormatting(false);
								settings.setEnableGWT(false);
								settings.setEnableCppFormatting(false);
								if (!settings.isProjectSpecific()) {
									GlobalSettings.getInstance().updateSettings(settings, project);
								}

								notification.hideBalloon();
							}
						}),
				project));

	}
	if (eclipseCodeStyleManager == null) {
		eclipseCodeStyleManager = projectCodeStyle.install(settings);
	} else {
		eclipseCodeStyleManager.updateSettings(settings);
	}
}
 
源代码10 项目: netbeans   文件: HTMLTextArea.java
public void hyperlinkUpdate(HyperlinkEvent e) {
    if (!isEnabled()) {
        return;
    }

    if (e.getEventType() == HyperlinkEvent.EventType.ACTIVATED) {
        activeLink = e.getURL();
        showURL(activeLink, e.getInputEvent());
    } else if (e.getEventType() == HyperlinkEvent.EventType.ENTERED) {
        activeLink = e.getURL();
        setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));
    } else if (e.getEventType() == HyperlinkEvent.EventType.EXITED) {
        activeLink = null;
        setCursor(Cursor.getDefaultCursor());
    }
}
 
源代码11 项目: Darcula   文件: HTMLPanel.java
public void hyperlinkUpdate(HyperlinkEvent event) {
    JEditorPane descriptionPane = (JEditorPane) event.getSource();
    HyperlinkEvent.EventType type = event.getEventType();
    if (type == HyperlinkEvent.EventType.ACTIVATED) {
        try {
            DemoUtilities.browse(event.getURL().toURI());
        } catch (Exception e) {
            e.printStackTrace();
            System.err.println(e);
        }

    } else if (type == HyperlinkEvent.EventType.ENTERED) {
        defaultCursor = descriptionPane.getCursor();
        descriptionPane.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));

    } else if (type == HyperlinkEvent.EventType.EXITED) {
        descriptionPane.setCursor(defaultCursor);
    }
}
 
源代码12 项目: ganttproject   文件: UIFacadeImpl.java
@Override
public void showNotificationDialog(NotificationChannel channel, String message) {
  String i18nPrefix = channel.name().toLowerCase() + ".channel.";
  getNotificationManager().addNotifications(
      channel,
      Collections.singletonList(new NotificationItem(i18n(i18nPrefix + "itemTitle"),
          GanttLanguage.getInstance().formatText(i18nPrefix + "itemBody", message), new HyperlinkListener() {
        @Override
        public void hyperlinkUpdate(HyperlinkEvent e) {
          if (e.getEventType() != EventType.ACTIVATED) {
            return;
          }
          if ("localhost".equals(e.getURL().getHost()) && "/log".equals(e.getURL().getPath())) {
            onViewLog();
          } else {
            NotificationManager.DEFAULT_HYPERLINK_LISTENER.hyperlinkUpdate(e);
          }
        }
      })));
}
 
源代码13 项目: mars-sim   文件: WebViewHyperlinkListenerDemo.java
/**
 * Visualizes the specified event's type and URL on the specified label.
 *
 * @param event
 *            the {@link HyperlinkEvent} to visualize
 * @param urlLabel
 *            the {@link Label} which will visualize the event
 */
private static void showEventOnLabel(HyperlinkEvent event, Label urlLabel) {
	if (event.getEventType() == EventType.ENTERED) {
		urlLabel.setTextFill(Color.BLACK);
		urlLabel.setText("ENTERED: " + event.getURL().toExternalForm());
		System.out.println("EVENT: " + WebViews.hyperlinkEventToString(event));
	} else if (event.getEventType() == EventType.EXITED) {
		urlLabel.setTextFill(Color.BLACK);
		urlLabel.setText("EXITED: " + event.getURL().toExternalForm());
		System.out.println("EVENT: " + WebViews.hyperlinkEventToString(event));
	} else if (event.getEventType() == EventType.ACTIVATED) {
		urlLabel.setText("ACTIVATED: " + event.getURL().toExternalForm());
		urlLabel.setTextFill(Color.RED);
		System.out.println("EVENT: " + WebViews.hyperlinkEventToString(event));
	}
}
 
源代码14 项目: consulo   文件: PackagesNotificationPanel.java
public PackagesNotificationPanel() {
  myHtmlViewer = SwingHelper.createHtmlViewer(true, null, null, null);
  myHtmlViewer.setVisible(false);
  myHtmlViewer.setOpaque(true);
  myHtmlViewer.addHyperlinkListener(new HyperlinkAdapter() {
    @Override
    protected void hyperlinkActivated(HyperlinkEvent e) {
      final Runnable handler = myLinkHandlers.get(e.getDescription());
      if (handler != null) {
        handler.run();
      }
      else if (myErrorTitle != null && myErrorDescription != null) {
        showError(myErrorTitle, myErrorDescription);
      }
    }
  });
}
 
源代码15 项目: beautyeye   文件: EditorPaneDemo.java
private HyperlinkListener createHyperLinkListener() {
    return new HyperlinkListener() {
        public void hyperlinkUpdate(HyperlinkEvent e) {
            if (e.getEventType() == HyperlinkEvent.EventType.ACTIVATED) {
                if (e instanceof HTMLFrameHyperlinkEvent) {
                    ((HTMLDocument) html.getDocument()).processHTMLFrameHyperlinkEvent(
                            (HTMLFrameHyperlinkEvent) e);
                } else {
                    try {
                        html.setPage(e.getURL());
                    } catch (IOException ioe) {
                        System.out.println("IOE: " + ioe);
                    }
                }
            }
        }
    };
}
 
源代码16 项目: gcs   文件: ExportToGURPSCalculatorCommand.java
private void showResult(boolean success) {
    String message = success ? I18n.Text("Export to GURPS Calculator was successful.") : I18n.Text("There was an error exporting to GURPS Calculator. Please try again later.");
    String key     = Preferences.getInstance().getGURPSCalculatorKey();
    if (key == null || !key.matches("[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-5][0-9a-fA-F]{3}-[89ab][0-9a-fA-F]{3}-[0-9a-fA-F]{12}")) {
        message = String.format(I18n.Text("You need to set a valid GURPS Calculator Key in sheet preferences.<br><a href='%s'>Click here</a> for more information."), OutputPreferences.GURPS_CALCULATOR_URL);
    }
    JLabel      styleLabel  = new JLabel();
    Font        font        = styleLabel.getFont();
    Color       color       = styleLabel.getBackground();
    JEditorPane messagePane = new JEditorPane("text/html", "<html><body style='font-family:" + font.getFamily() + ";font-weight:" + (font.isBold() ? "bold" : "normal") + ";font-size:" + font.getSize() + "pt;background-color: rgb(" + color.getRed() + "," + color.getGreen() + "," + color.getBlue() + ");'>" + message + "</body></html>");
    messagePane.setEditable(false);
    messagePane.setBorder(null);
    messagePane.addHyperlinkListener(event -> {
        if (Desktop.isDesktopSupported() && event.getEventType().equals(HyperlinkEvent.EventType.ACTIVATED)) {
            URL url = event.getURL();
            try {
                Desktop.getDesktop().browse(url.toURI());
            } catch (IOException | URISyntaxException exception) {
                WindowUtils.showError(null, MessageFormat.format(I18n.Text("Unable to open {0}"), url.toExternalForm()));
            }
        }
    });
    JOptionPane.showMessageDialog(Command.getFocusOwner(), messagePane, success ? I18n.Text("Success") : I18n.Text("Error"), success ? JOptionPane.INFORMATION_MESSAGE : JOptionPane.ERROR_MESSAGE);
}
 
源代码17 项目: scelight   文件: Browser.java
/**
 * Creates a new {@link Browser}.
 */
public Browser() {
	setEditable( false );
	setContentType( "text/html" );
	
	addHyperlinkListener( new HyperlinkListener() {
		@Override
		public void hyperlinkUpdate( final HyperlinkEvent event ) {
			if ( event.getEventType() == HyperlinkEvent.EventType.ACTIVATED ) {
				if ( event.getURL() != null )
					LEnv.UTILS_IMPL.get().showURLInBrowser( event.getURL() );
			} else if ( event.getEventType() == HyperlinkEvent.EventType.ENTERED ) {
				if ( event.getURL() != null )
					setToolTipText( LUtils.urlToolTip( event.getURL() ) );
			} else if ( event.getEventType() == HyperlinkEvent.EventType.EXITED )
				setToolTipText( null );
		}
	} );
}
 
@Override
public void hyperlinkUpdate(@Nonnull Notification notification, @Nonnull HyperlinkEvent event) {
  if (event.getEventType() == HyperlinkEvent.EventType.ACTIVATED) {
    final String description = event.getDescription();
    if ("enable".equals(description)) {
      KeyboardSettingsExternalizable.getInstance().setNonEnglishKeyboardSupportEnabled(true);
    }
    else if ("settings".equals(description)) {
      final ShowSettingsUtil util = ShowSettingsUtil.getInstance();
      IdeFrame ideFrame = WindowManagerEx.getInstanceEx().findFrameFor(null);
      //util.editConfigurable((JFrame)ideFrame, new StatisticsConfigurable(true));
      util.showSettingsDialog(ideFrame.getProject(), KeymapPanel.class);
    }

    NotificationsConfiguration.getNotificationsConfiguration().changeSettings(LOCALIZATION_GROUP_DISPLAY_ID, NotificationDisplayType.NONE, false, false);
    notification.expire();
  }
}
 
源代码19 项目: visualvm   文件: HTMLTextArea.java
public void hyperlinkUpdate(HyperlinkEvent e) {
    if (!isEnabled()) {
        return;
    }

    if (e.getEventType() == HyperlinkEvent.EventType.ACTIVATED) {
        activeLink = e.getURL();
        showURL(activeLink, e.getInputEvent());
    } else if (e.getEventType() == HyperlinkEvent.EventType.ENTERED) {
        activeLink = e.getURL();
        setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));
    } else if (e.getEventType() == HyperlinkEvent.EventType.EXITED) {
        activeLink = null;
        setCursor(Cursor.getDefaultCursor());
    }
}
 
源代码20 项目: eslint-plugin   文件: ESLintInspection.java
@NotNull
    private HyperlinkLabel createHyperLink() {
        List path = ContainerUtil.newArrayList(JSBundle.message("settings.javascript.root.configurable.name"), JSBundle.message("settings.javascript.linters.configurable.name"), getDisplayName());

        String title = Joiner.on(" / ").join(path);
        final HyperlinkLabel settingsLink = new HyperlinkLabel(title);
        settingsLink.addHyperlinkListener(new HyperlinkAdapter() {
            public void hyperlinkActivated(HyperlinkEvent e) {
//                DataContext dataContext = DataManager.getInstance().getDataContext(settingsLink);
//                OptionsEditor optionsEditor = OptionsEditor.KEY.getData(dataContext);
//                if (optionsEditor == null) {
//                    Project project = CommonDataKeys.PROJECT.getData(dataContext);
//                    if (project != null) {
//                        showSettings(project);
//                    }
//                    return;
//                }
//                Configurable configurable = optionsEditor.findConfigurableById(ESLintInspection.this.getId());
//                if (configurable != null) {
//                    optionsEditor.clearSearchAndSelect(configurable);
//                }
            }
        });
        return settingsLink;
    }
 
源代码21 项目: tmc-intellij   文件: AboutTmcDialog.java
public AboutTmcDialog() {
    super(
            WindowManager.getInstance()
                    .getFrame(ProjectManager.getInstance().getDefaultProject()),
            false);
    initComponents();

    this.headerLabel.setText("About Test My Code");
    this.infoTextPane.setText("<html> <body> <div> Test My Code is a service designed for learning and teaching programming. It is open "
                    + "source, provides support for automatic assessment of programming assignments, and comes with a server "
                    + "that can be used to maintain course-specific point lists and grading. </div> <br> <div> "
                    + "Find out more at <a href=\"https://mooc.fi/tmc\">https://mooc.fi/tmc</a>. </div> </body> </html>");
    this.closeButton.setText("Close");

    this.infoTextPane.addHyperlinkListener((HyperlinkEvent e) -> {
        if (e.getEventType() == HyperlinkEvent.EventType.ACTIVATED) {
            try {
                Desktop desktop = Desktop.getDesktop();
                desktop.browse(new URI("https://mooc.fi/tmc"));
            } catch (Exception ex) {
                new ErrorMessageService().showErrorMessagePopup("Failed to open browser.\n" + ex.getMessage());
            }
        }
    });
}
 
源代码22 项目: beautyeye   文件: HTMLPanel.java
public void hyperlinkUpdate(HyperlinkEvent event) {
    JEditorPane descriptionPane = (JEditorPane) event.getSource();
    HyperlinkEvent.EventType type = event.getEventType();
    if (type == HyperlinkEvent.EventType.ACTIVATED) {
        try {
            DemoUtilities.browse(event.getURL().toURI());
        } catch (Exception e) {
            e.printStackTrace();
            System.err.println(e);
        }

    } else if (type == HyperlinkEvent.EventType.ENTERED) {
        defaultCursor = descriptionPane.getCursor();
        descriptionPane.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));

    } else if (type == HyperlinkEvent.EventType.EXITED) {
        descriptionPane.setCursor(defaultCursor);
    }
}
 
源代码23 项目: consulo   文件: Browser.java
public Browser(@Nonnull InspectionResultsView view) {
  super(new BorderLayout());
  myView = view;

  myCurrentEntity = null;
  myCurrentDescriptor = null;

  myHTMLViewer = new JEditorPane(UIUtil.HTML_MIME, InspectionsBundle.message("inspection.offline.view.empty.browser.text"));
  myHTMLViewer.setEditable(false);
  myHyperLinkListener = new HyperlinkListener() {
    @Override
    public void hyperlinkUpdate(HyperlinkEvent e) {
      Browser.this.hyperlinkUpdate(e);
    }
  };
  myHTMLViewer.addHyperlinkListener(myHyperLinkListener);

  final JScrollPane pane = ScrollPaneFactory.createScrollPane(myHTMLViewer);
  pane.setBorder(null);
  add(pane, BorderLayout.CENTER);
  setupStyle();
}
 
源代码24 项目: fabric-installer   文件: ClientHandler.java
private void showInstalledMessage(String loaderVersion, String gameVersion) {
	JEditorPane pane = new JEditorPane("text/html", "<html><body style=\"" + buildEditorPaneStyle() + "\">" + new MessageFormat(Utils.BUNDLE.getString("prompt.install.successful")).format(new Object[]{loaderVersion, gameVersion, Reference.fabricApiUrl}) + "</body></html>");
	pane.setEditable(false);
	pane.addHyperlinkListener(e -> {
		try {
			if (e.getEventType() == HyperlinkEvent.EventType.ACTIVATED) {
				if (Desktop.isDesktopSupported() && Desktop.getDesktop().isSupported(Desktop.Action.BROWSE)) {
					Desktop.getDesktop().browse(e.getURL().toURI());
				} else {
					throw new UnsupportedOperationException("Failed to open " + e.getURL().toString());
				}
			}
		} catch (Throwable throwable) {
			error(throwable);
		}
	});
	JOptionPane.showMessageDialog(null, pane, Utils.BUNDLE.getString("prompt.install.successful.title"), JOptionPane.INFORMATION_MESSAGE);
}
 
源代码25 项目: jpexs-decompiler   文件: TagInfoPanel.java
public TagInfoPanel(MainPanel mainPanel) {
    this.mainPanel = mainPanel;
    setLayout(new BorderLayout());
    JLabel topLabel = new JLabel(AppStrings.translate("taginfo.header"), JLabel.CENTER);
    add(topLabel, BorderLayout.NORTH);
    add(new JScrollPane(editorPane), BorderLayout.CENTER);

    editorPane.setContentType("text/html");
    editorPane.setEditable(false);

    HyperlinkListener listener = new HyperlinkListener() {
        @Override
        public void hyperlinkUpdate(HyperlinkEvent hyperLink) {

            if (HyperlinkEvent.EventType.ACTIVATED.equals(hyperLink.getEventType())) {
                String url = hyperLink.getDescription();
                String strId = url.substring(7);
                Integer id = Integer.parseInt(strId);

                mainPanel.setTagTreeSelectedNode(mainPanel.getCurrentSwf().getCharacter(id));
            }
        }

    };

    editorPane.addHyperlinkListener(listener);
}
 
源代码26 项目: bigtable-sql   文件: HtmlViewerPanel.java
private HyperlinkListener createHyperLinkListener()
{
	return new HyperlinkListener()
	{
		public void hyperlinkUpdate(HyperlinkEvent e)
		{
			if (e.getEventType() == HyperlinkEvent.EventType.ACTIVATED)
			{
				if (e instanceof HTMLFrameHyperlinkEvent)
				{
					((HTMLDocument)_contentsTxt.getDocument()).processHTMLFrameHyperlinkEvent((HTMLFrameHyperlinkEvent)e);
				}
				else
				{
					try
					{
						gotoURL(e.getURL());
					}
					catch (IOException ex)
					{
                           // i18n[HtmlViewerPanel.error.processhyperlink=Error processing hyperlink]
						s_log.error(s_stringMgr.getString("HtmlViewerPanel.error.processhyperlink"), ex);
					}
				}
			}
		}
	};
}
 
源代码27 项目: CrossMobile   文件: SwingWebWrapper.java
@Override
public void hyperlinkUpdate(HyperlinkEvent e) {
    UIWebView wv = getIOSWidget();
    if (wv == null)
        return;

    UIWebViewDelegate del = wv.delegate();
    if (del != null && e.getURL() != null && del.shouldStartLoadWithRequest(wv, NSURLRequest.requestWithURL(NSURL.URLWithString(e.getURL().toString())), UIWebViewNavigationType.LinkClicked))
        Native.system().debug("Will move to URL " + e.getURL(), null);
}
 
源代码28 项目: consulo   文件: SearchForUsagesRunnable.java
@Nonnull
private HyperlinkListener createGotToOptionsListener(@Nonnull final UsageTarget[] targets) {
  return new HyperlinkAdapter() {
    @Override
    protected void hyperlinkActivated(HyperlinkEvent e) {
      if (e.getDescription().equals(FIND_OPTIONS_HREF_TARGET)) {
        TransactionGuard.getInstance().submitTransactionAndWait(() -> FindManager.getInstance(myProject).showSettingsAndFindUsages(targets));
      }
    }
  };
}
 
源代码29 项目: consulo   文件: NotificationData.java
public NotificationData(@Nonnull String title,
                        @Nonnull String message,
                        @Nonnull NotificationCategory notificationCategory,
                        @Nonnull NotificationSource notificationSource,
                        @Nullable String filePath,
                        int line,
                        int column,
                        boolean balloonNotification) {
  myTitle = title;
  myMessage = message;
  myNotificationCategory = notificationCategory;
  myNotificationSource = notificationSource;
  myListenerMap = ContainerUtil.newHashMap();
  myListener = new NotificationListener.Adapter() {
    @Override
    protected void hyperlinkActivated(@Nonnull Notification notification, @Nonnull HyperlinkEvent event) {
      if (event.getEventType() != HyperlinkEvent.EventType.ACTIVATED) return;

      final NotificationListener notificationListener = myListenerMap.get(event.getDescription());
      if (notificationListener != null) {
        notificationListener.hyperlinkUpdate(notification, event);
      }
    }
  };
  myFilePath = filePath;
  myLine = line;
  myColumn = column;
  myBalloonNotification = balloonNotification;
}
 
源代码30 项目: mktool   文件: MainGUI.java
private Object getUpdateInfo() {
  showProgress(true);
  String str;
  if (UnpackRepackUtil.internet()) {
    if (!UnpackRepackUtil.getAppVersion().contains(appVersion)) {
      str = "New Update Available!<br>" +
        "For the latest update visit:<br>" +
        "<a href=\"https://techstop.github.io/mktool/\" style=\"color: #0099cc\">https://techstop.github.io/mktool/</a>";
    } else {
      str = "No updates available!";
    }
  } else {
    str = "No internet connection detected!";
  }
  JEditorPane editor = new JEditorPane();
  editor.setEditorKit(JEditorPane.createEditorKitForContentType("text/html"));
  editor.setEditable(false);
  editor.setText(str);
  editor.addHyperlinkListener(new HyperlinkListener() {
    public void hyperlinkUpdate(HyperlinkEvent e) {
      if (e.getEventType() == HyperlinkEvent.EventType.ACTIVATED) {
        if (Desktop.isDesktopSupported()) {
          try {
            Desktop.getDesktop().browse(e.getURL().toURI());
          } catch (IOException | URISyntaxException ex) {
            ex.printStackTrace();
          }
        }
      }
    }
  });
  showProgress(false);
  return editor;
}
 
 类所在包
 同包方法