本文整理了Java中javax.swing.JMenuItem.setIcon()
方法的一些代码示例,展示了JMenuItem.setIcon()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。JMenuItem.setIcon()
方法的具体详情如下:
包路径:javax.swing.JMenuItem
类名称:JMenuItem
方法名:setIcon
暂无
代码示例来源:origin: skylot/jadx
JMenuItem item = new JMenuItem(clsName);
item.addActionListener(e -> setSelectedComponent(cp));
item.setIcon(node.getIcon());
menu.add(item);
代码示例来源:origin: marytts/marytts
jMenuItem_Open.setIcon(new javax.swing.ImageIcon(getClass().getResource("/marytts/tools/redstart/open_16x16.png")));
jMenuItem_Open.setText("Open Voice...");
jMenuItem_Open.addActionListener(new java.awt.event.ActionListener() {
jMenuItem_Exit.setIcon(new javax.swing.ImageIcon(getClass().getResource("/marytts/tools/redstart/exit_16x16.png")));
jMenuItem_Exit.setText("Exit");
jMenuItem_Exit.addActionListener(new java.awt.event.ActionListener() {
jMenuItem_Options.setIcon(new javax.swing.ImageIcon(getClass().getResource("/marytts/tools/redstart/options_16x16.png")));
jMenuItem_Options.setText("Options...");
jMenuItem_Options.addActionListener(new java.awt.event.ActionListener() {
jMenu_About.setIcon(new javax.swing.ImageIcon(getClass().getResource("/marytts/tools/redstart/about_16x16.png")));
jMenu_About.setText("About Redstart");
jMenu_About.addActionListener(new java.awt.event.ActionListener() {
代码示例来源:origin: ron190/jsql-injection
public JPopupMenuTable(JTable tableValues, Action actionShowSearchTable) {
this(tableValues);
this.addSeparator();
JMenuItem search = new JMenuItem();
search.setAction(actionShowSearchTable);
search.setText("Search...");
search.setMnemonic('S');
search.setIcon(HelperUi.ICON_EMPTY);
search.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_F, ActionEvent.CTRL_MASK));
this.add(search);
}
代码示例来源:origin: ron190/jsql-injection
/**
* Create popup menu for this component.
* @param component The component receiving the menu
*/
public JPopupMenuText(JTextComponent component) {
super(component);
if (component.isEditable()) {
JMenuItem cutItem = new JMenuItem();
cutItem.setIcon(HelperUi.ICON_EMPTY);
cutItem.setAction(component.getActionMap().get(DefaultEditorKit.cutAction));
cutItem.setText("Cut");
cutItem.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_X, ActionEvent.CTRL_MASK));
cutItem.setMnemonic('t');
JMenuItem pasteItem = new JMenuItem();
pasteItem.setIcon(HelperUi.ICON_EMPTY);
pasteItem.setAction(component.getActionMap().get(DefaultEditorKit.pasteAction));
pasteItem.setText("Paste");
pasteItem.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_V, ActionEvent.CTRL_MASK));
pasteItem.setMnemonic('P');
// Before Copy menu
this.add(cutItem, 0);
// After Copy menu
this.add(pasteItem, 2);
}
}
代码示例来源:origin: org.netbeans.api/org-openide-awt
curItem.setIcon(BLANK_ICON);
代码示例来源:origin: ron190/jsql-injection
I18nView.addComponentForKey("CONTEXT_MENU_COPY", copyItem);
copyItem.setMnemonic('C');
copyItem.setIcon(HelperUi.ICON_EMPTY);
copyItem.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_C, ActionEvent.CTRL_MASK));
this.add(copyItem);
I18nView.addComponentForKey("CONTEXT_MENU_SELECT_ALL", selectAllItem);
selectAllItem.setMnemonic('A');
selectAllItem.setIcon(HelperUi.ICON_EMPTY);
selectAllItem.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_A, ActionEvent.CTRL_MASK));
this.add(selectAllItem);
代码示例来源:origin: ron190/jsql-injection
I18nView.addComponentForKey("COLUMNS_UNCHECK_ALL", menuItemUncheckAll);
menuItemCheckAll.setIcon(HelperUi.ICON_EMPTY);
menuItemUncheckAll.setIcon(HelperUi.ICON_EMPTY);
menuItemUncheckAll.addActionListener(new ActionUncheckAll());
menuItemCheckAll.setIcon(HelperUi.ICON_EMPTY);
menuItemUncheckAll.setIcon(HelperUi.ICON_EMPTY);
代码示例来源:origin: ron190/jsql-injection
I18nView.addComponentForKey("CONTEXT_MENU_SELECT_ALL", mnSelectAll);
mnImport.setIcon(HelperUi.ICON_EMPTY);
mnExport.setIcon(HelperUi.ICON_EMPTY);
mnCut.setIcon(HelperUi.ICON_EMPTY);
mnCopy.setIcon(HelperUi.ICON_EMPTY);
mnPaste.setIcon(HelperUi.ICON_EMPTY);
mnDelete.setIcon(HelperUi.ICON_EMPTY);
mnNew.setIcon(HelperUi.ICON_EMPTY);
mnRestoreDefault.setIcon(HelperUi.ICON_EMPTY);
mnSelectAll.setIcon(HelperUi.ICON_EMPTY);
代码示例来源:origin: ron190/jsql-injection
copyItem.setText(I18n.valueByKey("CONTEXT_MENU_COPY"));
I18nView.addComponentForKey("CONTEXT_MENU_COPY", copyItem);
copyItem.setIcon(HelperUi.ICON_EMPTY);
this.setLightWeightPopupEnabled(false);
selectAllItem.setIcon(HelperUi.ICON_EMPTY);
selectAllItem.setAction(component.getActionMap().get(DefaultEditorKit.selectAllAction));
selectAllItem.setText(I18n.valueByKey("CONTEXT_MENU_SELECT_ALL"));
) {
JMenuItem clearItem = new JMenuItem();
clearItem.setIcon(HelperUi.ICON_EMPTY);
clearItem.setAction(new AbstractAction() {
代码示例来源:origin: ron190/jsql-injection
itemExit.setIcon(HelperUi.ICON_EMPTY);
itemExit.addActionListener(actionEvent -> MediatorGui.frame().dispose());
itemCopy.setIcon(HelperUi.ICON_EMPTY);
itemCopy.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_C, ActionEvent.CTRL_MASK));
itemCopy.addActionListener(actionEvent -> {
itemSelectAll.setIcon(HelperUi.ICON_EMPTY);
itemSelectAll.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_A, ActionEvent.CTRL_MASK));
itemSelectAll.addActionListener(actionEvent -> {
preferences.setIcon(HelperUi.ICON_EMPTY);
I18nView.addComponentForKey("MENUBAR_PREFERENCES", preferences);
itemHelp.setIcon(HelperUi.ICON_EMPTY);
I18nView.addComponentForKey("MENUBAR_HELP_ABOUT", itemHelp);
itemUpdate.setIcon(HelperUi.ICON_EMPTY);
I18nView.addComponentForKey("MENUBAR_HELP_UPDATE", itemUpdate);
itemReportIssue.setIcon(HelperUi.ICON_EMPTY);
I18nView.addComponentForKey("MENUBAR_COMMUNITY_REPORTISSUE", itemReportIssue);
代码示例来源:origin: ron190/jsql-injection
itemCopyUrl.setIcon(HelperUi.ICON_EMPTY);
itemCopy.setText(I18n.valueByKey("CONTEXT_MENU_COPY"));
I18nView.addComponentForKey("CONTEXT_MENU_COPY", itemCopy);
itemCopy.setIcon(HelperUi.ICON_EMPTY);
itemSelectAll.setIcon(HelperUi.ICON_EMPTY);
itemSelectAll.setAction(browser.getActionMap().get(DefaultEditorKit.selectAllAction));
itemSelectAll.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_A, ActionEvent.CTRL_MASK));
代码示例来源:origin: ron190/jsql-injection
'o'
);
mnLoad.setIcon(HelperUi.ICON_EMPTY);
's'
);
mnPause.setIcon(HelperUi.ICON_EMPTY);
: "?"
);
mnReload.setIcon(HelperUi.ICON_EMPTY);
mnRename.setIcon(HelperUi.ICON_EMPTY);
代码示例来源:origin: com.dorkbox/SystemTray
@Override
public
void run() {
if (isChecked) {
_native.setIcon(checkedIcon);
}
else {
_native.setIcon(SwingMenuItem.transparentIcon);
}
}
});
代码示例来源:origin: chatty/chatty
private JMenuItem makeItem(String action, String text, ImageIcon icon) {
JMenuItem item = new JMenuItem(text);
item.setActionCommand(action);
item.addActionListener(listener);
if (icon != null) {
item.setIcon(icon);
}
return item;
}
代码示例来源:origin: chatty/chatty
public final void setAction(String key, Action action) {
JMenuItem item = menuItems.get(key);
// Preserve icon
Icon icon = item.getIcon();
item.setAction(action);
item.setIcon(icon);
}
代码示例来源:origin: freeplane/freeplane
private void addAction(final JMenu menu, final AbstractAction action) {
final JMenuItem item = menu.add(action);
LabelAndMnemonicSetter.setLabelAndMnemonic(item, (String) action.getValue(Action.NAME));
item.setIcon(new BlindIcon(UIBuilder.ICON_SIZE));
}
代码示例来源:origin: org.scijava/scijava-ui-swing
private void assignProperties(final JMenuItem menuItem,
final ShadowMenu shadow)
{
final char mnemonic = shadow.getMenuEntry().getMnemonic();
if (mnemonic != '\0') menuItem.setMnemonic(mnemonic);
final KeyStroke keyStroke = getKeyStroke(shadow);
if (keyStroke != null) menuItem.setAccelerator(keyStroke);
final Icon icon = loadIcon(shadow);
if (icon != null) menuItem.setIcon(icon);
final ModuleInfo info = shadow.getModuleInfo();
if (info != null) menuItem.setEnabled(info.isEnabled());
}
代码示例来源:origin: net.imagej/ij-ui-swing
private void assignProperties(final JMenuItem menuItem,
final ShadowMenu shadow)
{
final char mnemonic = shadow.getMenuEntry().getMnemonic();
if (mnemonic != '\0') menuItem.setMnemonic(mnemonic);
final KeyStroke keyStroke = getKeyStroke(shadow);
if (keyStroke != null) menuItem.setAccelerator(keyStroke);
final Icon icon = loadIcon(shadow);
if (icon != null) menuItem.setIcon(icon);
final ModuleInfo info = shadow.getModuleInfo();
if (info != null) menuItem.setEnabled(info.isEnabled());
}
代码示例来源:origin: igniterealtime/Spark
@Override
public void finished() {
refreshButton.setIcon(SparkRes.getImageIcon(SparkRes.BUSY_IMAGE));
refreshButton.validate();
refreshButton.repaint();
refreshItem.setIcon(SparkRes.getImageIcon(SparkRes.BUSY_IMAGE));
refreshItem.validate();
refreshItem.repaint();
}
};
代码示例来源:origin: igniterealtime/Spark
public void finished() {
refreshButton.setIcon(SparkRes.getImageIcon(SparkRes.REFRESH_IMAGE));
refreshButton.validate();
refreshButton.repaint();
refreshItem.setIcon(SparkRes.getImageIcon(SparkRes.REFRESH_IMAGE));
refreshItem.validate();
refreshItem.repaint();
}
};
内容来源于网络,如有侵权,请联系作者删除!