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

The following examples show how to use javax.swing.JCheckBoxMenuItem#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: BoolSettingAction.java    From scelight with Apache License 2.0 5 votes vote down vote up
/**
 * Overrides {@link XAction#addToMenu(JMenu)} to add a {@link JCheckBoxMenuItem} instead of a {@link JMenuItem}.
 */
@Override
public JMenuItem addToMenu( final JMenu menu ) {
	final JCheckBoxMenuItem mi = new JCheckBoxMenuItem();
	
	menu.add( mi );
	mi.setAction( this );
	mi.setToolTipText( null ); // We don't want tool tip on menu items...
	
	return mi;
}
 
Example 2
Source File: BoolSettingAction.java    From scelight with Apache License 2.0 5 votes vote down vote up
/**
 * Overrides {@link XAction#addToMenu(JPopupMenu)} to add a {@link JCheckBoxMenuItem} instead of a {@link JMenuItem}.
 */
@Override
public JMenuItem addToMenu( final JPopupMenu menu ) {
	final JCheckBoxMenuItem mi = new JCheckBoxMenuItem();
	
	menu.add( mi );
	mi.setAction( this );
	mi.setToolTipText( null ); // We don't want tool tip on menu items...
	
	return mi;
}
 
Example 3
Source File: Desktop.java    From knopflerfish.org with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
JMenu makeStopOptionsMenu()
{
  return new JMenu(Strings.get("menu_stopOptions")) {
    private static final long serialVersionUID = 1L;

    {
      setToolTipText(Strings.get("menu_stopOptions.descr"));

      final ItemListener itemListener = new ItemListener() {
        @Override
        public void itemStateChanged(ItemEvent e)
        {
          updateNameOfActionStopBundles();
        }
      };

      itemStopOptionsTransient =
        new JCheckBoxMenuItem(Strings.get("stop_option_transient"), false);
      itemStopOptionsTransient.setToolTipText(Strings
          .get("stop_option_transient.descr"));
      itemStopOptionsTransient.addItemListener(itemListener);

      add(itemStopOptionsTransient);
      updateNameOfActionStopBundles();
    }
  };
}
 
Example 4
Source File: Desktop.java    From knopflerfish.org with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
JMenu makeStartOptionsMenu()
{
  return new JMenu(Strings.get("menu_startOptions")) {
    private static final long serialVersionUID = 1L;

    {
      setToolTipText(Strings.get("menu_startOptions.descr"));

      final ItemListener itemListener = new ItemListener() {
        @Override
        public void itemStateChanged(ItemEvent e)
        {
          updateNameOfActionStartBundles();
        }
      };

      itemStartOptionsTransient =
        new JCheckBoxMenuItem(Strings.get("start_option_transient"), false);
      itemStartOptionsTransient.setToolTipText(Strings
          .get("start_option_transient.descr"));
      itemStartOptionsTransient.addItemListener(itemListener);

      itemStartOptionsPolicy =
        new JCheckBoxMenuItem(Strings.get("start_option_policy"), true);
      itemStartOptionsPolicy.setToolTipText(Strings
          .get("start_option_policy.descr"));
      itemStartOptionsPolicy.addItemListener(itemListener);

      add(itemStartOptionsTransient);
      add(itemStartOptionsPolicy);
      updateNameOfActionStartBundles();
    }
  };
}
 
Example 5
Source File: DockableMenu.java    From rapidminer-studio with GNU Affero General Public License v3.0 4 votes vote down vote up
void fill() {
	removeAll();

	DockableState[] dockables = dockingContext.getDesktopList().get(0).getDockables();
	List<DockableState> sorted = new LinkedList<>();
	sorted.addAll(Arrays.asList(dockables));
	sorted.sort(Comparator.comparing(o -> o.getDockable().getDockKey().getName()));
	for (final DockableState state : sorted) {
		if (state.getDockable() instanceof DummyDockable) {
			continue;
		}
		DockKey dockKey = state.getDockable().getDockKey();
		String keyName = dockKey.getKey();
		boolean cont = false;
		for (String prefix : HIDE_IN_DOCKABLE_MENU_PREFIX_REGISTRY) {
			if (keyName.startsWith(prefix)) {
				cont = true;
				break;
			}
		}
		if (cont) {
			continue;
		}
		String description = null;
		if (dockKey instanceof ResourceDockKey) {
			description = ((ResourceDockKey) dockKey).getShortDescription();
		}
		description = description != null ? description : "";
		String text = dockKey.getName();
		if (SystemInfoUtilities.getOperatingSystem() != OperatingSystem.OSX) {
			// OS X cannot use html in menus so only do it for other OS
			text = String.format(DOCKABLE_HTML, dockKey.getName(), description);
		}
		JCheckBoxMenuItem item = new JCheckBoxMenuItem(text, dockKey.getIcon());
		item.setSelected(!state.isClosed());
		item.addActionListener(e -> toggleState(state));

		// special handling for results overview dockable in Results perspective
		// and process view dockable in Design perspective
		// these dockables are not allowed to be closed so we disable this item while in respective perspective
		String perspectiveName = RapidMinerGUI.getMainFrame().getPerspectiveController().getModel().getSelectedPerspective().getName();
		if ((PerspectiveModel.RESULT.equals(perspectiveName) && ResultDisplay.RESULT_DOCK_KEY.equals(keyName))
				|| (PerspectiveModel.DESIGN.equals(perspectiveName) && ProcessPanel.PROCESS_PANEL_DOCK_KEY.equals(keyName))) {
			item.setEnabled(false);
			item.setToolTipText(I18N.getGUIMessage("gui.label.dockable.unclosable.tip"));
		}
		add(item);
		ensurePopupHeight();
	}
}