當前位置: 首頁>>代碼示例>>Java>>正文


Java JMenu.setToolTipText方法代碼示例

本文整理匯總了Java中javax.swing.JMenu.setToolTipText方法的典型用法代碼示例。如果您正苦於以下問題:Java JMenu.setToolTipText方法的具體用法?Java JMenu.setToolTipText怎麽用?Java JMenu.setToolTipText使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在javax.swing.JMenu的用法示例。


在下文中一共展示了JMenu.setToolTipText方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: createTypeMenu

import javax.swing.JMenu; //導入方法依賴的package包/類
/**
 * @return menu that allows to select possible column types
 */
private JMenu createTypeMenu() {
	ButtonGroup typeGroup = new ButtonGroup();
	JMenu typeChangeItem = new JMenu(CHANGE_TYPE_LABEL);
	typeChangeItem.setToolTipText(CHANGE_TYPE_TIP);
	for (final ColumnType columnType : ColumnType.values()) {
		final JCheckBoxMenuItem checkboxItem = new JCheckBoxMenuItem(
				DataImportWizardUtils.getNameForColumnType(columnType));
		if (columnType == metaData.getColumnMetaData(columnIndex).getType()) {
			checkboxItem.setSelected(true);
		}
		checkboxItem.addItemListener(new ItemListener() {

			@Override
			public void itemStateChanged(ItemEvent e) {
				if (e.getStateChange() == ItemEvent.SELECTED) {
					changeType(columnType);
				}

			}
		});
		typeGroup.add(checkboxItem);
		typeChangeItem.add(checkboxItem);
	}
	return typeChangeItem;
}
 
開發者ID:transwarpio,項目名稱:rapidminer,代碼行數:29,代碼來源:ConfigureDataTableHeader.java

示例2: getHelpMenu

import javax.swing.JMenu; //導入方法依賴的package包/類
JMenu getHelpMenu() {
	JMenu helpMenu = new JMenu("Help");
	helpMenu.setToolTipText("help");
	JMenuItem mi = new JMenuItem("How To...");
	mi.addActionListener( new ActionListener() {
		public void actionPerformed(ActionEvent e) {
			String helpText = "";
			String s = "";
			URL helpURL = null;
			try {
				helpURL = URLFactory.url(ProfileToolURL);
				BufferedReader in = new BufferedReader( new InputStreamReader( helpURL.openStream() ) );

				while((s=in.readLine())!=null){
					helpText = helpText.concat(s);
				}
			} catch (Exception e1) {
				// TODO Auto-generated catch block
				e1.printStackTrace();
			}
			JOptionPane.showMessageDialog(null, helpText, "Help", JOptionPane.PLAIN_MESSAGE);
		}
	});
	helpMenu.add(mi);
	return helpMenu;
}
 
開發者ID:iedadata,項目名稱:geomapapp,代碼行數:27,代碼來源:GMAProfile.java

示例3: addParentMenu

import javax.swing.JMenu; //導入方法依賴的package包/類
/**
 * Adds a parent menu to this menu bar.
 * @param name the name of the parent menu
 * @param tooltip the description text that will be shown when the mouse is over this item
 * @param enabled indicates whehter or not the item will be enabled
 */
public void addParentMenu(String name, String tooltip, boolean enabled) {
    JMenu menu = new JMenu (name,enabled);
    menu.setToolTipText(tooltip);
    
    parentMenus.put(name,menu);
    add(menu);
}
 
開發者ID:guilhebl,項目名稱:routerapp,代碼行數:14,代碼來源:Menu.java

示例4: RunScriptAction

import javax.swing.JMenu; //導入方法依賴的package包/類
private RunScriptAction(Lookup context, JTextComponent editor, FileObject scriptOrFolder, 
        String name, String description) {
    this();
    this.context = context;
    this.editor = editor;
    this.storage = PersistentSnippetsSupport.create(context);
    this.scriptFile = scriptOrFolder;
    putValue(NAME, name);
    if (scriptFile == null) {
        putValue(SHORT_DESCRIPTION, Bundle.DESC_RunSavedScript());
        putValue(SMALL_ICON, ImageUtilities.loadImageIcon(RESOURCE_ICON, false));
    } else {
        putValue(SHORT_DESCRIPTION, description);
    }
    
    if (storage == null) {
        setEnabled(false);
        return;
    }
    
    boolean enabled = true;
    
    
    if (scriptOrFolder == null || scriptOrFolder.isFolder()) {
        if (scriptOrFolder == null) {
            popup = new JPopupMenu() {
                @Override
                public int getComponentCount() {
                    refresh();
                    return super.getComponentCount();
                }
            };
        } else {
            subMenu = new JMenu() {
                @Override
                public int getMenuComponentCount() {
                    refresh();
                    return super.getMenuComponentCount();
                }
            };
            subMenu.setText(name);
            subMenu.setToolTipText(description);
        }
        if (storage.getSavedClasses(null).isEmpty()) {
            setEnabled(false);
        }
        invalidate();
        if (scriptOrFolder != null) {
            FileChangeListener fcl = WeakListeners.create(FileChangeListener.class, listen, scriptOrFolder);
            scriptOrFolder.addFileChangeListener(fcl);
            weakListen = fcl;
        } else {
            ChangeListener cl = WeakListeners.change(listen, storage);
            storage.addChangeListener(cl);
            weakListen = cl;
        }
    }
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:59,代碼來源:RunScriptAction.java


注:本文中的javax.swing.JMenu.setToolTipText方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。