Java Code Examples for javax.swing.JRadioButtonMenuItem#setToolTipText()

The following examples show how to use javax.swing.JRadioButtonMenuItem#setToolTipText() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: ComponentSource.java    From LoboBrowser with MIT License 6 votes vote down vote up
private void populateSearchers() {
  final JMenu searchersMenu = this.searchersMenu;
  searchersMenu.removeAll();
  final ToolsSettings settings = ToolsSettings.getInstance();
  final Collection<SearchEngine> searchEngines = settings.getSearchEngines();
  final SearchEngine selectedEngine = settings.getSelectedSearchEngine();
  if (searchEngines != null) {
    for (final SearchEngine se : searchEngines) {
      final SearchEngine finalSe = se;
      final JRadioButtonMenuItem item = new JRadioButtonMenuItem();
      item.setAction(new AbstractAction() {
        private static final long serialVersionUID = -3263394523150719487L;

        public void actionPerformed(final ActionEvent e) {
          settings.setSelectedSearchEngine(finalSe);
          settings.save();
          ComponentSource.this.updateSearchButtonTooltip();
        }
      });
      item.setSelected(se == selectedEngine);
      item.setText(se.getName());
      item.setToolTipText(se.getDescription());
      searchersMenu.add(item);
    }
  }
}