本文整理汇总了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;
}
示例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;
}
示例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);
}
示例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;
}
}
}