本文整理汇总了Java中javax.swing.JMenu类的典型用法代码示例。如果您正苦于以下问题:Java JMenu类的具体用法?Java JMenu怎么用?Java JMenu使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
JMenu类属于javax.swing包,在下文中一共展示了JMenu类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: PopuleBarra
import javax.swing.JMenu; //导入依赖的package包/类
public void PopuleBarra(JMenu obj) {
int i = 0;
for (ConfigAcao ca : Lista) {
if (ca.tipo == TipoConfigAcao.tpMenuBarra || ca.tipo == TipoConfigAcao.tpAny) {
Acao ac = new Acao(editor, ca.texto, ca.ico, ca.descricao, ca.command);
ac.IDX = i++;
JMenuItem mi = new JMenuItem(ac);
//obj.add(mi);
listaMenus.put(ca.command, mi);
//ListaDeAcoes.add(ac);
}
}
obj.setText(Editor.fromConfiguracao.getValor("Controler.interface.menu.menuDiagrama.texto"));
char b = Editor.fromConfiguracao.getValor("Controler.interface.menu.menuDiagrama.mtecla").charAt(0);
obj.setMnemonic(b);
BarraMenu = obj;
}
示例2: addFoldingActionsToPopUpMenu
import javax.swing.JMenu; //导入依赖的package包/类
private void addFoldingActionsToPopUpMenu(JPopupMenu menu,
List<TabAction> activeActions) {
JMenu submenu = new JMenu(NbBundle.getMessage(
OutputTab.class, "LBL_OutputFolds")); //NOI18N
for (ACTION a : popUpFoldItems) {
if (a == null) {
submenu.addSeparator();
} else {
TabAction ta = action(a);
activeActions.add(ta);
submenu.add(new JMenuItem(ta));
}
}
menu.addSeparator();
menu.add(submenu);
}
示例3: createPopupMenu
import javax.swing.JMenu; //导入依赖的package包/类
@Override
public JMenu createPopupMenu(Point atPoint) {
MyJMenu result = new MyJMenu("Popup");
switch (getGraphRole()) {
case HOST:
result.add(getActions().getApplyMatchAction());
result.addSeparator();
break;
default:
// do nothing
}
Action editAction;
if (isForState()) {
editAction = getActions().getEditStateAction();
} else {
editAction = getActions().getEditAction(ResourceKind.toResource(getGraphRole()));
}
result.add(editAction);
result.addSubmenu(createEditMenu(atPoint));
result.addSubmenu(super.createPopupMenu(atPoint));
return result;
}
示例4: attachWorkspace
import javax.swing.JMenu; //导入依赖的package包/类
/** Initializes listeners atc to the given workspace */
void attachWorkspace(
Workspace workspace, Workspace[] currentDeskRef, Hashtable workspace2Menu, Hashtable menu2Workspace,
Hashtable workspace2Listener, JMenu menu
) {
// bugfix #6116 - change from getName() to getDisplayName()
JRadioButtonMenuItem menuItem = new JRadioButtonMenuItem();
Mnemonics.setLocalizedText(menuItem, workspace.getDisplayName());
HelpCtx.setHelpIDString(menuItem, WorkspaceSwitchAction.class.getName());
ActionListener listener = createActionListener(menuItem, currentDeskRef, menu2Workspace, workspace2Menu);
menuItem.addActionListener(listener);
menu2Workspace.put(listener, workspace);
workspace2Listener.put(workspace, listener);
workspace2Menu.put(workspace, menuItem);
workspace.addPropertyChangeListener(createNameListener(menuItem));
menu.add(menuItem);
}
示例5: buildGameMenu
import javax.swing.JMenu; //导入依赖的package包/类
private void buildGameMenu() {
// --> Game
JMenu menu = Utility.localizedMenu("menuBar.game");
menu.setOpaque(false);
menu.setMnemonic(KeyEvent.VK_G);
menu.add(getMenuItem(NewAction.id));
menu.add(getMenuItem(NewEmptyMapAction.id));
menu.addSeparator();
menu.add(getMenuItem(OpenAction.id));
menu.add(getMenuItem(SaveAction.id));
menu.add(getMenuItem(StartMapAction.id));
menu.addSeparator();
menu.add(getMenuItem(PreferencesAction.id));
menu.addSeparator();
menu.add(getMenuItem(ShowMainAction.id));
menu.add(getMenuItem(QuitAction.id));
add(menu);
}
示例6: createWindowMenu
import javax.swing.JMenu; //导入依赖的package包/类
private JMenu createWindowMenu() {
JMenu window = new JMenu("Window");
window.setMnemonic('W');
window.add(
withMnemonics(
withEmptyIcon(
withShortCut(Utils.createMenuItem("Test Design", sActionListener))), 'T'));
window.add(
withMnemonics(
withShortCut(
Utils.createMenuItem("Test Execution", sActionListener)), 'E'));
window.add(
withMnemonics(
withShortCut(
Utils.createMenuItem("Dashboard", sActionListener)), 'D'));
window.add(
withMnemonics(
withShortCut(
Utils.createMenuItem("AdjustUI", sActionListener)), 'A'));
return window;
}
示例7: init
import javax.swing.JMenu; //导入依赖的package包/类
private void init() {
JMenu pfMenu = new JMenu("Playfield graphics");
JMenu help = new JMenu("Help");
Settings settings = new Settings(UNDERLAY_NS);
if (settings.contains("fileName")) {
// create underlay image menu item only if filename is specified
enableBgImage = createCheckItem(pfMenu,"Show underlay image",false);
}
enableNodeName = createCheckItem(pfMenu, "Show node name string",true);
enableNodeCoverage = createCheckItem(pfMenu,
"Show node radio coverage", true);
enableNodeConnections = createCheckItem(pfMenu,
"Show node's connections", true);
enableMapGraphic = createCheckItem(pfMenu,"Show map graphic",true);
autoClearOverlay = createCheckItem(pfMenu, "Autoclear overlay",true);
clearOverlay = createMenuItem(pfMenu,"Clear overlays now");
about = createMenuItem(help,"about");
this.add(pfMenu);
this.add(Box.createHorizontalGlue());
this.add(help);
}
示例8: setProjectMenuItems
import javax.swing.JMenu; //导入依赖的package包/类
/**
* Create's the Window=>MenuItems depending on the open projects
*/
private void setProjectMenuItems() {
boolean setFontBold = true;
JMenu WindowMenu = Application.getMainWindow().getJMenuMainWindow();
WindowMenu.removeAll();
if (this.count()==0 ){
WindowMenu.add( new JMenuItmen_Window( Language.translate("Kein Projekt geöffnet !"), -1, setFontBold ) );
} else {
for(int i=0; i<this.count(); i++) {
String ProjectName = this.getProjectsOpen().get(i).getProjectName();
if ( ProjectName.equalsIgnoreCase( Application.getProjectFocused().getProjectName() ) )
setFontBold = true;
else
setFontBold = false;
WindowMenu.add( new JMenuItmen_Window( ProjectName, i, setFontBold) );
}
}
}
示例9: recreateStateMenu
import javax.swing.JMenu; //导入依赖的package包/类
private void recreateStateMenu(JMenu menu, ArrayList<CircuitStateMenuItem> items, int code) {
menu.removeAll();
menu.setEnabled(items.size() > 0);
boolean first = true;
int mask = getToolkit().getMenuShortcutKeyMask();
for (int i = items.size() - 1; i >= 0; i--) {
JMenuItem item = items.get(i);
menu.add(item);
if (first) {
item.setAccelerator(KeyStroke.getKeyStroke(code, mask));
first = false;
} else {
item.setAccelerator(null);
}
}
}
示例10: init
import javax.swing.JMenu; //导入依赖的package包/类
protected final void init() {
add(addScenario = create("Add Scenario", Keystroke.NEW));
add(renameScenario = create("Rename Scenario", Keystroke.RENAME));
add(deleteScenario = create("Delete Scenario", Keystroke.DELETE));
addSeparator();
add(addTestCase = create("Add TestCase", Keystroke.NEW));
add(renameTestCase = create("Rename TestCase", Keystroke.RENAME));
add(deleteTestCase = create("Delete TestCase", Keystroke.DELETE));
addSeparator();
JMenu menu = new JMenu("Export As");
menu.add(create("Manual Testcase", null));
add(menu);
add(toggleReusable = create("Make As Reusable/TestCase", null));
toggleReusable.setText("Make As Reusable");
addSeparator();
setCCP();
addSeparator();
add(impactAnalysis = create("Get Impacted TestCases", null));
add(getCmdSyntax = create("Get CmdLine Syntax", null));
addSeparator();
add(sort = create("Sort", null));
addSeparator();
add(create("Details", Keystroke.ALTENTER));
sort.setIcon(Canvas.EmptyIcon);
}
示例11: getPopupMenuItem
import javax.swing.JMenu; //导入依赖的package包/类
public @Override JMenuItem getPopupMenuItem(JTextComponent target) {
String menuText = org.openide.util.NbBundle.getBundle (NbEditorKit.class).
getString("Menu/View/CodeFolds");
JMenu menu = new JMenu(menuText);
Mnemonics.setLocalizedText(menu, menuText);
setAddSeparatorBeforeNextAction(false);
addAction(target, menu, BaseKit.collapseFoldAction);
addAction(target, menu, BaseKit.expandFoldAction);
setAddSeparatorBeforeNextAction(true);
addAction(target, menu, BaseKit.collapseAllFoldsAction);
addAction(target, menu, BaseKit.expandAllFoldsAction);
// this is a hack, which assumes a certain action name from editor.fold.ui
// if the action does not exist, nothing will be added to the menu.
addAction(target, menu, "collapse-fold-tree"); // NOI18N
addAction(target, menu, "expand-fold-tree"); // NOI18N
// By default add separator before next actions (can be overriden if unwanted)
setAddSeparatorBeforeNextAction(true);
if (target != null) addAdditionalItems(target, menu);
return menu;
}
示例12: KMeanScatterPopupMenu
import javax.swing.JMenu; //导入依赖的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();
}
示例13: getPopupPresenter
import javax.swing.JMenu; //导入依赖的package包/类
public JMenuItem getPopupPresenter() {
JMenu displayAsPopup = new JMenu();
Mnemonics.setLocalizedText(displayAsPopup, NbBundle.getMessage(DebuggingActionsProvider.class, "CTL_Session_Popup_Language"));
String [] languages = session.getSupportedLanguages();
String currentLanguage = session.getCurrentLanguage();
for (int i = 0; i < languages.length; i++) {
final String language = languages[i];
JRadioButtonMenuItem langItem = new JRadioButtonMenuItem(new AbstractAction(language) {
public void actionPerformed(ActionEvent e) {
session.setCurrentLanguage(language);
}
});
if (currentLanguage.equals(language)) langItem.setSelected(true);
displayAsPopup.add(langItem);
}
return displayAsPopup;
}
示例14: addFoldTypes
import javax.swing.JMenu; //导入依赖的package包/类
private void addFoldTypes (JTextComponent target, JMenu menu, Language language, Set expands) {
List<Feature> features = language.getFeatureList ().getFeatures (LanguagesFoldManager.FOLD);
Iterator<Feature> it = features.iterator ();
while (it.hasNext ()) {
Feature fold = it.next ();
String expand = LocalizationSupport.localize (language, (String) fold.getValue ("expand_type_action_name"));
if (expand == null) continue;
if (expands.contains (expand))
continue;
expands.add (expand);
String collapse = LocalizationSupport.localize (language, (String) fold.getValue ("collapse_type_action_name"));
if (collapse == null) continue;
addAction (target, menu, EXPAND_PREFIX + expand);
addAction (target, menu, COLLAPSE_PREFIX + collapse);
setAddSeparatorBeforeNextAction (true);
}
}
示例15: KMeanScatterPopupMenu
import javax.swing.JMenu; //导入依赖的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();
}