本文整理了Java中javax.swing.JMenu.isEnabled()
方法的一些代码示例,展示了JMenu.isEnabled()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。JMenu.isEnabled()
方法的具体详情如下:
包路径:javax.swing.JMenu
类名称:JMenu
方法名:isEnabled
暂无
代码示例来源:origin: robward-scisys/sldeditor
@Override
public boolean isEnabled() {
if (this.menu != null) {
return this.menu.isEnabled();
}
return false;
}
}
代码示例来源:origin: com.synaptix/SynaptixSwing
public boolean isEnabledMenuById(String id) {
return menusMap.get(id).isEnabled();
}
代码示例来源:origin: com.eas.platypus/platypus-js-forms
@ScriptFunction(jsDoc = ENABLED_JSDOC)
@Override
public boolean getEnabled() {
return super.isEnabled();
}
代码示例来源:origin: com.jidesoft/jide-oss
/**
* Invoked when a mouse button is pressed on the menu and then dragged. Delegates the mouse event to the
* MenuSelectionManager.
*
* @param e the mouse event
* @see java.awt.event.MouseMotionListener#mouseDragged
*/
public void mouseDragged(MouseEvent e) {
JMenu menu = (JMenu) menuItem;
if (!menu.isEnabled())
return;
MenuSelectionManager.defaultManager().processMouseEvent(e);
}
代码示例来源:origin: com.jidesoft/jide-oss
/**
* Invoked when a mouse button is pressed on the menu and then dragged. Delegates the mouse event to the
* MenuSelectionManager.
*
* @param e the mouse event
* @see java.awt.event.MouseMotionListener#mouseDragged
*/
public void mouseDragged(MouseEvent e) {
JMenu menu = (JMenu) menuItem;
if (!menu.isEnabled())
return;
MenuSelectionManager.defaultManager().processMouseEvent(e);
}
代码示例来源:origin: com.jidesoft/jide-oss
/**
* Invoked when a mouse button is pressed on the menu and then dragged. Delegates the mouse event to the
* MenuSelectionManager.
*
* @param e the mouse event
* @see java.awt.event.MouseMotionListener#mouseDragged
*/
public void mouseDragged(MouseEvent e) {
JMenu menu = (JMenu) menuItem;
if (!menu.isEnabled())
return;
MenuSelectionManager.defaultManager().processMouseEvent(e);
}
代码示例来源:origin: com.jidesoft/jide-oss
/**
* Invoked when a mouse button is pressed on the menu and then dragged. Delegates the mouse event to the
* MenuSelectionManager.
*
* @param e the mouse event
* @see java.awt.event.MouseMotionListener#mouseDragged
*/
public void mouseDragged(MouseEvent e) {
JMenu menu = (JMenu) menuItem;
if (!menu.isEnabled())
return;
MenuSelectionManager.defaultManager().processMouseEvent(e);
}
代码示例来源:origin: net.sf.squirrel-sql.thirdparty-non-maven/toniclf
/**
* Invoked when a mouse button is pressed on the menu and then dragged.
* Delegates the mouse event to the MenuSelectionManager.
*
* @param e the mouse event
* @see java.awt.event.MouseMotionListener#mouseDragged
*/
public void mouseDragged(MouseEvent e) {
JMenu menu = (JMenu)menuItem;
if (!menu.isEnabled())
return;
MenuSelectionManager.defaultManager().processMouseEvent(e);
}
public void mouseMoved(MouseEvent e) {
代码示例来源:origin: com.jidesoft/jide-oss
/**
* Invoked when a mouse button is pressed on the menu and then dragged. Delegates the mouse event to the
* MenuSelectionManager.
*
* @param e the mouse event
* @see MouseMotionListener#mouseDragged
*/
public void mouseDragged(MouseEvent e) {
if (!(menuItem instanceof JMenu)) {
return;
}
JMenu menu = (JMenu) menuItem;
if (!menu.isEnabled())
return;
MenuSelectionManager.defaultManager().processMouseEvent(e);
}
代码示例来源:origin: com.jidesoft/jide-oss
/**
* Invoked when a mouse button is pressed on the menu and then dragged. Delegates the mouse event to the
* MenuSelectionManager.
*
* @param e the mouse event
* @see MouseMotionListener#mouseDragged
*/
public void mouseDragged(MouseEvent e) {
if (!(menuItem instanceof JMenu)) {
return;
}
JMenu menu = (JMenu) menuItem;
if (!menu.isEnabled())
return;
MenuSelectionManager.defaultManager().processMouseEvent(e);
}
代码示例来源:origin: nroduit/Weasis
public JMenu getResetMenu(String prop) {
JMenu menu = null;
if (BundleTools.SYSTEM_PREFERENCES.getBooleanProperty(prop, true)) {
ButtonGroup group = new ButtonGroup();
menu = new JMenu(Messages.getString("ResetTools.reset")); //$NON-NLS-1$
menu.setIcon(new ImageIcon(DefaultView2d.class.getResource("/icon/16x16/reset.png"))); //$NON-NLS-1$
menu.setEnabled(getSelectedSeries() != null);
if (menu.isEnabled()) {
for (final ResetTools action : ResetTools.values()) {
final JMenuItem item = new JMenuItem(action.toString());
if (ResetTools.ALL.equals(action)) {
item.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_ESCAPE, 0));
}
item.addActionListener(e -> reset(action));
menu.add(item);
group.add(item);
}
}
}
return menu;
}
代码示例来源:origin: de.sciss/submin
@Override
protected void paintBackground(Graphics2D g2d, boolean selected) {
if (component.getParent() instanceof JPopupMenu) {
// super.paintBackground ( g2d, selected );
if (selected) {
g2d.setPaint(new GradientPaint(0, 0, selectedTopBg, 0, component.getHeight(), selectedBottomBg));
g2d.fillRect(0, 0, component.getWidth(), component.getHeight());
}
} else {
if (component.isEnabled() && (selected || mouseover)) {
// LafUtils.drawWebStyle ( g2d, component, shadeColor, shadeWidth, round, component.isEnabled (),
// !selected && mouseover, selected ? StyleConstants.averageBorderColor : StyleConstants.borderColor );
// final Color borderColor = selected ? StyleConstants.averageBorderColor : StyleConstants.borderColor;
// final float opacity = mouseover ? getHoverOpacity () : 1f;
final float opacity = selected ? 1f : getHoverOpacity();
final Paint bgPaint = new GradientPaint(0, 0, selectedTopBg, 0, component.getHeight(), selectedBottomBg);
drawShape(g2d, component, shadeColor, shadeWidth, round, component.isEnabled(),
borderColor, borderColor, bgPaint, opacity);
}
}
}
代码示例来源:origin: nroduit/Weasis
public JMenu getResetMenu(String prop) {
JMenu menu = null;
if (BundleTools.SYSTEM_PREFERENCES.getBooleanProperty(prop, true)) {
ButtonGroup group = new ButtonGroup();
menu = new JMenu(Messages.getString("ResetTools.reset")); //$NON-NLS-1$
menu.setIcon(new ImageIcon(DefaultView2d.class.getResource("/icon/16x16/reset.png"))); //$NON-NLS-1$
menu.setEnabled(getSelectedSeries() != null);
if (menu.isEnabled()) {
for (final ResetTools action : ResetTools.values()) {
final JMenuItem item = new JMenuItem(action.toString());
if (ResetTools.ALL.equals(action)) {
item.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_ESCAPE, 0));
}
item.addActionListener(e -> reset(action));
menu.add(item);
group.add(item);
}
}
}
return menu;
}
代码示例来源:origin: net.sf.squirrel-sql.thirdparty-non-maven/toniclf
/**
* Invoked when the mouse has been released on the menu. Delegates the
* mouse event to the MenuSelectionManager.
*
* @param e the mouse event
*/
public void mouseReleased(MouseEvent e) {
JMenu menu = (JMenu)menuItem;
if (!menu.isEnabled())
return;
MenuSelectionManager manager =
MenuSelectionManager.defaultManager();
manager.processMouseEvent(e);
if (!e.isConsumed())
manager.clearSelectedPath();
}
代码示例来源:origin: com.jidesoft/jide-oss
/**
* Invoked when the mouse has been released on the menu. Delegates the mouse event to the MenuSelectionManager.
*
* @param e the mouse event
*/
public void mouseReleased(MouseEvent e) {
if (!(menuItem instanceof JMenu)) {
return;
}
JMenu menu = (JMenu) menuItem;
if (!menu.isEnabled())
return;
MenuSelectionManager manager =
MenuSelectionManager.defaultManager();
manager.processMouseEvent(e);
if (!e.isConsumed())
manager.clearSelectedPath();
}
代码示例来源:origin: com.jidesoft/jide-oss
public void mouseMoved(MouseEvent e) {
JMenu menu = (JMenu) menuItem;
if (!menu.isEnabled())
return;
if (menuItem instanceof JideSplitButton) {
if (isClickOnButton(e, ((JMenu) menuItem))) {
((SplitButtonModel) ((JideSplitButton) menuItem).getModel()).setButtonRollover(true);
}
else {
((SplitButtonModel) ((JideSplitButton) menuItem).getModel()).setButtonRollover(false);
}
}
}
}
代码示例来源:origin: com.jidesoft/jide-oss
/**
* Invoked when the mouse has been released on the menu. Delegates the mouse event to the MenuSelectionManager.
*
* @param e the mouse event
*/
public void mouseReleased(MouseEvent e) {
if (!SwingUtilities.isLeftMouseButton(e)) {
return;
}
if (!(menuItem instanceof JMenu)) {
return;
}
JMenu menu = (JMenu) menuItem;
if (!menu.isEnabled())
return;
MenuSelectionManager manager =
MenuSelectionManager.defaultManager();
manager.processMouseEvent(e);
if (!e.isConsumed())
manager.clearSelectedPath();
}
代码示例来源:origin: com.jidesoft/jide-oss
/**
* Invoked when the mouse has been released on the menu. Delegates the mouse event to the MenuSelectionManager.
*
* @param e the mouse event
*/
public void mouseReleased(MouseEvent e) {
JMenu menu = (JMenu) menuItem;
if (!menu.isEnabled()) {
return;
}
if (!isClickOnButton(e, menu)) {
// these two lines order matters. In this order, it would not trigger actionPerformed.
menuItem.getModel().setArmed(false);
menuItem.getModel().setPressed(false);
}
cancelMenuIfNecessary(e);
}
代码示例来源:origin: com.jidesoft/jide-oss
/**
* Invoked when the mouse has been released on the menu. Delegates the mouse event to the MenuSelectionManager.
*
* @param e the mouse event
*/
public void mouseReleased(MouseEvent e) {
JMenu menu = (JMenu) menuItem;
if (!menu.isEnabled()) {
return;
}
if (!isClickOnButton(e, menu)) {
// these two lines order matters. In this order, it would not trigger actionPerformed.
menuItem.getModel().setArmed(false);
menuItem.getModel().setPressed(false);
}
cancelMenuIfNecessary(e);
}
代码示例来源:origin: com.jidesoft/jide-oss
/**
* Invoked when the mouse has been released on the menu. Delegates the mouse event to the MenuSelectionManager.
*
* @param e the mouse event
*/
public void mouseReleased(MouseEvent e) {
JMenu menu = (JMenu) menuItem;
if (!menu.isEnabled()) {
return;
}
if (!isClickOnButton(e, menu)) {
// these two lines order matters. In this order, it would not trigger actionPerformed.
menuItem.getModel().setArmed(false);
menuItem.getModel().setPressed(false);
}
cancelMenuIfNecessary(e);
}
内容来源于网络,如有侵权,请联系作者删除!