本文整理了Java中javax.swing.JMenuItem.isArmed()
方法的一些代码示例,展示了JMenuItem.isArmed()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。JMenuItem.isArmed()
方法的具体详情如下:
包路径:javax.swing.JMenuItem
类名称:JMenuItem
方法名:isArmed
暂无
代码示例来源:origin: ron190/jsql-injection
@Override
public void stateChanged(ChangeEvent e) {
if (e.getSource() instanceof JMenuItem) {
JMenuItem item = (JMenuItem) e.getSource();
if (item.isSelected() || item.isArmed()) {
ManagerCoder.this.actionCoder.actionPerformed(this.nameMethod);
}
}
}
代码示例来源:origin: stackoverflow.com
ChangeListener ch = new ChangeListener() {
@Override
public void stateChanged(ChangeEvent e) {
if (e.getSource() instanceof JMenuItem) {
JMenuItem item = (JMenuItem) e.getSource();
if (item.isSelected() || item.isArmed()) {
System.out.println("Highlighted: " + item.getActionCommand());
}
}
}
};
代码示例来源:origin: org.bitbucket.goalhub.simpleide/jedit
public void stateChanged(ChangeEvent e)
{
JMenuItem menuItem = (JMenuItem) e.getSource();
view.getStatus().setMessage(menuItem.isArmed()?menuItem.getActionCommand():null);
}
}; //}}}
代码示例来源:origin: net.sf.tinylaf/tinylaf
g.setColor(Theme.menuIconDisabledColor.getColor());
else if(item.isArmed()) {
g.setColor(Theme.menuIconRolloverColor.getColor());
代码示例来源:origin: io.ultreia.java4all.jaxx/jaxx-runtime
protected boolean canExecuteAction(ActionEvent e) {
AbstractButton editor = getEditor();
Objects.requireNonNull(editor);
if (!editor.isVisible() || !editor.isEnabled()) {
return false;
}
if (editor instanceof JMenuItem) {
return ((JMenuItem) editor).isArmed();
}
return editor.isShowing();
}
代码示例来源:origin: khuxtable/seaglass
private int getComponentState(JComponent c) {
int state;
if (!c.isEnabled()) {
state = DISABLED;
} else if (menuItem.isArmed()) {
state = MOUSE_OVER;
} else {
state = SeaGlassLookAndFeel.getComponentState(c);
}
if (menuItem.isSelected()) {
state |= SELECTED;
}
return state;
}
代码示例来源:origin: stackoverflow.com
public void menuKeyReleased(MenuKeyEvent e) {
if (e.getModifiers() == 0) {
switch (e.getKeyCode()) {
case KeyEvent.VK_ENTER:
case KeyEvent.VK_SPACE:
for (MenuElement elem : this.getSubElements()) {
if (elem instanceof JMenuItem) {
JMenuItem item = (JMenuItem) elem;
if (item.isArmed()) {
Action action = item.getAction();
if (action != null) {
action.actionPerformed(new ActionEvent(this, 0, null));
e.consume();
setVisible(false);
}
}
}
}
}
}
}
代码示例来源:origin: khuxtable/seaglass
private int getComponentState(JComponent c) {
int state;
if (!c.isEnabled()) {
return DISABLED;
}
if (menuItem.isArmed()) {
state = MOUSE_OVER;
} else {
state = SeaGlassLookAndFeel.getComponentState(c);
}
if (menuItem.isSelected()) {
state |= SELECTED;
}
return state;
}
代码示例来源:origin: net.sf.tinylaf/tinylaf
bgColor = Theme.menuPopupColor.getColor();
else if(b.isArmed()) {
iconColor = Theme.menuIconRolloverColor.getColor();
bgColor = Theme.menuItemRolloverColor.getColor();
代码示例来源:origin: kaikramer/keystore-explorer
/**
* Menu item's state has changed - if armed show its help text, otherwise
* hide any help text.
*
* @param evt
* The change event
*/
@Override
public void stateChanged(ChangeEvent evt) {
/*
* Only bother if not using Mac OS - on there stateChagned is not fired
* for the application manu bar's items so for consistency we will fire
* it at all
*/
if (!OperatingSystem.isMacOs()) {
if (jmi.isArmed()) {
// Display help text
statusBar.setStatusBarText(helpText);
} else {
// Display default status
statusBar.setDefaultStatusBarText();
}
}
}
}
代码示例来源:origin: net.sf.squirrel-sql.thirdparty-non-maven/skinlf
/**
* Description of the Method
*
* @param g Description of Parameter
* @param c Description of Parameter
* @return Description of the Returned Value
*/
public boolean paintMenuItem(java.awt.Graphics g, javax.swing.JMenuItem c) {
if (menuitemSelected != null) {
if (c.isArmed() || (c instanceof JMenu && c.getModel().isSelected())) {
menuitemSelected.paint(g, c);
}
/*
* else {
* paintDialog(g, c);
* }
*/
return true;
}
else {
return false;
}
}
代码示例来源:origin: stackoverflow.com
if (e.getSource() instanceof JMenuItem) {
JMenuItem item = (JMenuItem) e.getSource();
if (item.isSelected() || item.isArmed()) {
item.setIcon(stackIcon);
} else {
代码示例来源:origin: com.jtattoo/JTattoo
protected void paintText(Graphics g, JMenuItem menuItem, Rectangle textRect, String text) {
if (!AbstractLookAndFeel.getTheme().isDarkTexture()) {
super.paintText(g, menuItem, textRect, text);
return;
}
ButtonModel model = menuItem.getModel();
FontMetrics fm = JTattooUtilities.getFontMetrics(menuItem, g, menuItem.getFont());
int mnemIndex = menuItem.getDisplayedMnemonicIndex();
if (!menuItem.isArmed()) {
g.setColor(Color.black);
JTattooUtilities.drawStringUnderlineCharAt(menuItem, g, text, mnemIndex, textRect.x, textRect.y + fm.getAscent() - 1);
}
if (!model.isEnabled()) {
// *** paint the text disabled
g.setColor(ColorHelper.brighter(AbstractLookAndFeel.getDisabledForegroundColor(), 40));
} else {
// *** paint the text normally
if (menuItem.isArmed()) {
g.setColor(AbstractLookAndFeel.getMenuSelectionForegroundColor());
} else {
Color foreColor = menuItem.getForeground();
if (foreColor instanceof UIResource) {
foreColor = AbstractLookAndFeel.getMenuForegroundColor();
}
g.setColor(foreColor);
}
}
JTattooUtilities.drawStringUnderlineCharAt(menuItem, g, text, mnemIndex, textRect.x, textRect.y + fm.getAscent());
}
代码示例来源:origin: com.jtattoo/JTattoo
protected void paintText(Graphics g, JMenuItem menuItem, Rectangle textRect, String text) {
if (!AbstractLookAndFeel.getTheme().isDarkTexture()) {
super.paintText(g, menuItem, textRect, text);
return;
}
ButtonModel model = menuItem.getModel();
FontMetrics fm = JTattooUtilities.getFontMetrics(menuItem, g, menuItem.getFont());
int mnemIndex = menuItem.getDisplayedMnemonicIndex();
if (!menuItem.isArmed()) {
g.setColor(Color.black);
JTattooUtilities.drawStringUnderlineCharAt(menuItem, g, text, mnemIndex, textRect.x, textRect.y + fm.getAscent() - 1);
}
if (!model.isEnabled()) {
// *** paint the text disabled
g.setColor(ColorHelper.brighter(AbstractLookAndFeel.getDisabledForegroundColor(), 40));
} else {
// *** paint the text normally
if (menuItem.isArmed()) {
g.setColor(AbstractLookAndFeel.getMenuSelectionForegroundColor());
} else {
Color foreColor = menuItem.getForeground();
if (foreColor instanceof UIResource) {
foreColor = AbstractLookAndFeel.getMenuForegroundColor();
}
g.setColor(foreColor);
}
}
JTattooUtilities.drawStringUnderlineCharAt(menuItem, g, text, mnemIndex, textRect.x, textRect.y + fm.getAscent());
}
}
代码示例来源:origin: com.jtattoo/JTattoo
protected void paintText(Graphics g, JMenuItem menuItem, Rectangle textRect, String text) {
if (!AbstractLookAndFeel.getTheme().isDarkTexture()) {
super.paintText(g, menuItem, textRect, text);
return;
}
ButtonModel model = menuItem.getModel();
FontMetrics fm = JTattooUtilities.getFontMetrics(menuItem, g, menuItem.getFont());
int mnemIndex = menuItem.getDisplayedMnemonicIndex();
if (!menuItem.isArmed()) {
g.setColor(Color.black);
JTattooUtilities.drawStringUnderlineCharAt(menuItem, g, text, mnemIndex, textRect.x, textRect.y + fm.getAscent() - 1);
}
if (!model.isEnabled()) {
// *** paint the text disabled
g.setColor(ColorHelper.brighter(AbstractLookAndFeel.getDisabledForegroundColor(), 40));
} else {
// *** paint the text normally
if (menuItem.isArmed()) {
g.setColor(AbstractLookAndFeel.getMenuSelectionForegroundColor());
} else {
Color foreColor = menuItem.getForeground();
if (foreColor instanceof UIResource) {
foreColor = AbstractLookAndFeel.getMenuForegroundColor();
}
g.setColor(foreColor);
}
}
JTattooUtilities.drawStringUnderlineCharAt(menuItem, g, text, mnemIndex, textRect.x, textRect.y + fm.getAscent());
}
}
代码示例来源:origin: com.jtattoo/JTattoo
g.setColor(AbstractLookAndFeel.getMenuSelectionForegroundColor());
} else if (menuItem.isArmed() || menuItem.isSelected()) {
g.setColor(AbstractLookAndFeel.getMenuSelectionForegroundColor());
} else {
代码示例来源:origin: stackoverflow.com
if (menuItem.isArmed())
代码示例来源:origin: com.jtattoo/JTattoo
if (menuItem.isSelected() && menuItem.isArmed()) {
g.setColor(AbstractLookAndFeel.getMenuSelectionForegroundColor());
} else {
代码示例来源:origin: javax.help/javahelp
comp = c;
if (c instanceof JMenuItem && ((JMenuItem)c).isArmed()) {
comp = c;
内容来源于网络,如有侵权,请联系作者删除!