本文整理汇总了Java中javax.swing.JMenuItem.setText方法的典型用法代码示例。如果您正苦于以下问题:Java JMenuItem.setText方法的具体用法?Java JMenuItem.setText怎么用?Java JMenuItem.setText使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类javax.swing.JMenuItem
的用法示例。
在下文中一共展示了JMenuItem.setText方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: KMeanScatterPopupMenu
import javax.swing.JMenuItem; //导入方法依赖的package包/类
public KMeanScatterPopupMenu() {
restore = new JMenuItem("Original view");
saveAs = new JMenuItem("Save as...");
//clusters = new JMenu("Clusters");
printClusterInfo = new JMenuItem("Save info...");
point = new JMenu("Point size");
for (int i = 0; i < 5; i++) {
JMenuItem m = new JMenuItem();
m.setAction(commonActionSize);
m.setText("Size " + Integer.toString((i + 1)));
point.add(m);
}
this.add(restore);
this.addSeparator();
this.add(point);
this.addSeparator();
this.add(saveAs);
this.addSeparator();
this.add(printClusterInfo);
//this.addSeparator();
//this.add(clusters);
addListeners();
}
示例2: configureMenuItem
import javax.swing.JMenuItem; //导入方法依赖的package包/类
private void configureMenuItem (JMenuItem item, String containerCtx, String action, ActionProvider provider, Map context) {
// System.err.println("ConfigureMenuItem: " + containerCtx + "/" + action);
item.setName(action);
item.putClientProperty(KEY_ACTION, action);
item.putClientProperty(KEY_CONTAINERCONTEXT, containerCtx);
item.putClientProperty(KEY_CREATOR, this);
item.setText(
provider.getDisplayName(action, containerCtx));
// System.err.println(" item text is " + item.getText());
item.setToolTipText(provider.getDescription(action, containerCtx));
int state = context == null ? ActionProvider.STATE_ENABLED | ActionProvider.STATE_VISIBLE :
provider.getState (action, containerCtx, context);
boolean enabled = (state & ActionProvider.STATE_ENABLED) != 0;
// System.err.println("action " + action + (enabled ? " enabled" : " disabled"));
item.setEnabled(enabled);
boolean visible = (state & ActionProvider.STATE_VISIBLE) != 0;
// System.err.println("action " + action + (visible ? " visible" : " invisible"));
item.setVisible(visible);
item.setMnemonic(provider.getMnemonic(action, containerCtx));
item.setDisplayedMnemonicIndex(provider.getMnemonicIndex(action, containerCtx));
item.setIcon(provider.getIcon(action, containerCtx, BeanInfo.ICON_COLOR_16x16));
}
示例3: synchMenuPresenters
import javax.swing.JMenuItem; //导入方法依赖的package包/类
@NbBundle.Messages({
"LAB_ToolsActionInitializing=Initializing..."
})
@Override
public JComponent[] synchMenuPresenters(JComponent[] items) {
G g = gl(50);
if (g == null) {
JMenuItem init = new JMenuItem();
init.setText(Bundle.LAB_ToolsActionInitializing());
init.setEnabled(false);
return new JMenuItem[] { init };
}
if (timestamp == g.getTimestamp()) {
return items;
}
// generate directly list of menu items
List<JMenuItem> l = generate(toolsAction, true);
timestamp = gl().getTimestamp();
return l.toArray(new JMenuItem[l.size()]);
}
示例4: getTabPopupMenu
import javax.swing.JMenuItem; //导入方法依赖的package包/类
/**
* Returns the JPopupMenu for the tabs.
*
* @return the JPopupMenu
*/
private JPopupMenu getTabPopupMenu() {
JMenuItem jme = new JMenuItem();
if (isMaximizedTab) {
jme.setText(Language.translate("Wiederherstellen"));
} else {
jme.setText(Language.translate("Maximieren"));
}
jme.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
if (isMaximizedTab) {
currProject.setNotChangedButNotify(Project.VIEW_Restore);
} else {
currProject.setNotChangedButNotify(Project.VIEW_Maximize);
}
}
});
JPopupMenu pop = new JPopupMenu();
pop.add(jme);
return pop;
}
示例5: getJMenuItem4NetworkComponentProperties
import javax.swing.JMenuItem; //导入方法依赖的package包/类
/**
* Returns a JMenueItem for the properties of a NetworkComponent.
*
* @param networkComponent the NetworkComponent
* @return the JMenueItem for the specified NetworkComponent
*/
private JMenuItem getJMenuItem4NetworkComponentProperties(NetworkComponent networkComponent) {
final NetworkComponent networkComponent2Edit = networkComponent;
JMenuItem jMenuItem = new JMenuItem();
jMenuItem.setName(MENU_ITEM_NAME_PREFIX + "_JMenuItem_" + networkComponent.getId());
jMenuItem.setText(Language.translate("Edit Properties", Language.EN));
jMenuItem.setIcon(new ImageIcon(getClass().getResource(IMAGE_PATH + "Properties.png")));
jMenuItem.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
NetworkModelNotification nmn = new NetworkModelNotification(NetworkModelNotification.NETWORK_MODEL_EditComponentSettings);
nmn.setInfoObject(networkComponent2Edit);
basicGraphGui.getGraphEnvironmentController().notifyObservers(nmn);
}
});
return jMenuItem;
}
示例6: KMeanScatterPopupMenu
import javax.swing.JMenuItem; //导入方法依赖的package包/类
public KMeanScatterPopupMenu() {
restore = new JMenuItem("Original view");
saveAs = new JMenuItem("Save as...");
clusters = new JMenu("Clusters");
printClusterInfo = new JMenuItem("Save info...");
point = new JMenu("Point size");
for (int i = 0; i < 5; i++) {
JMenuItem m = new JMenuItem();
m.setAction(commonActionSize);
m.setText("Size " + Integer.toString((i + 1)));
point.add(m);
}
this.add(restore);
this.addSeparator();
this.add(point);
this.addSeparator();
this.add(saveAs);
this.addSeparator();
this.add(printClusterInfo);
this.addSeparator();
this.add(clusters);
addListeners();
}
示例7: ScatterPopupMenu
import javax.swing.JMenuItem; //导入方法依赖的package包/类
public ScatterPopupMenu() {
restore = new JMenuItem("Original view");
saveAs = new JMenuItem("Save as...");
point = new JMenu("Point size");
for (int i = 0; i < 5; i++) {
JMenuItem m = new JMenuItem();
m.setAction(commonActionSize);
m.setText("Size " + Integer.toString((i + 1)));
point.add(m);
}
this.add(restore);
this.addSeparator();
this.add(point);
this.addSeparator();
this.add(saveAs);
addListeners();
}
示例8: KMeanSingleClusterScatterPopupMenu
import javax.swing.JMenuItem; //导入方法依赖的package包/类
public KMeanSingleClusterScatterPopupMenu() {
restore = new JMenuItem("Original view");
saveAs = new JMenuItem("Save as...");
clusters = new JMenu("Cluster");
printClusterInfo = new JMenuItem("Save info...");
point = new JMenu("Point size");
for (int i = 0; i < 3; i++) {
JMenuItem m = new JMenuItem();
m.setAction(commonActionSize);
m.setText("Size " + Integer.toString((i + 1)));
point.add(m);
}
this.add(restore);
this.addSeparator();
this.add(point);
this.addSeparator();
this.add(saveAs);
this.addSeparator();
this.add(printClusterInfo);
this.addSeparator();
this.add(clusters);
addListeners();
}
示例9: KMeanScatterPopupMenu
import javax.swing.JMenuItem; //导入方法依赖的package包/类
public KMeanScatterPopupMenu() {
restore = new JMenuItem("Original view");
saveAs = new JMenuItem("Save as...");
clusters = new JMenu("Cluster");
printClusterInfo = new JMenuItem("Save info...");
point = new JMenu("Point size");
for (int i = 0; i < 3; i++) {
JMenuItem m = new JMenuItem();
m.setAction(commonActionSize);
m.setText("Size " + Integer.toString((i + 1)));
point.add(m);
}
this.add(restore);
this.addSeparator();
this.add(point);
this.addSeparator();
this.add(saveAs);
this.addSeparator();
this.add(printClusterInfo);
this.addSeparator();
this.add(clusters);
addListeners();
}
示例10: setActionMenuBar
import javax.swing.JMenuItem; //导入方法依赖的package包/类
public void setActionMenuBar(String menuItem, Action action) {
for (int i = 0; i < mMenuBar.getMenuCount(); i++) {
JMenu menu = mMenuBar.getMenu(i);
for (int j = 0; j < menu.getMenuComponentCount(); j++) {
Component component = menu.getMenuComponent(j);
if (component instanceof JMenuItem) {
JMenuItem item = (JMenuItem) component;
String description = (String) item.getAction().getValue(Action.SHORT_DESCRIPTION);
if (description.equals(menuItem)) {
item.setAction(action);
item.setText(menuItem);
break;
}
}
}
}
}
示例11: addActionItem
import javax.swing.JMenuItem; //导入方法依赖的package包/类
/**
* Add item for an action into a submenu (it the action exists).
*
* @param parent Parent to add the new item into.
* @param action ID of the action for {@link #getAction(String)}
* @param displayName Display name for the action.
*/
private void addActionItem(JMenu parent,
String action, String displayName) {
Action a = getAction(action);
if (a != null) {
JMenuItem item = new JMenuItem(a);
item.setText(displayName);
item.setIcon(null);
parent.add(item);
}
}
示例12: createMenuItem
import javax.swing.JMenuItem; //导入方法依赖的package包/类
public static JMenuItem createMenuItem(String action, String tooltip, KeyStroke keyStroke, ActionListener actionlistener) {
JMenuItem btn = new JMenuItem();
btn.setActionCommand(action);
btn.setText(action);
btn.setToolTipText("<html>" + action + (tooltip != null ? (" [" + tooltip + "]") : "") + "</html>");
btn.setAccelerator(keyStroke);
btn.addActionListener(actionlistener);
return btn;
}
示例13: getMenuPresenters
import javax.swing.JMenuItem; //导入方法依赖的package包/类
public JComponent[] getMenuPresenters() {
itm1 = new JMenuItem();
itm1.setText("1");
itm2 = new JMenuItem();
itm2.setText("2");
return new JComponent[] {
itm1,
itm2
};
}
示例14: getMenuPresenters
import javax.swing.JMenuItem; //导入方法依赖的package包/类
public JComponent[] getMenuPresenters() {
itm1 = new JMenuItem();
itm1.setText("1");
itm2 = new Dyna2();
itm2.setText("2");
return new JComponent[] {
itm1,
itm2
};
}
示例15: setNoMnemonicLabel
import javax.swing.JMenuItem; //导入方法依赖的package包/类
final public static void setNoMnemonicLabel(JMenuItem objPjMenuItem, String objPlabelString) {
objPjMenuItem.setText(MenusTools.getNoMnemonicLabel(objPlabelString));
}