javax.swing.JMenu.getModel()方法的使用及代码示例

x33g5p2x  于2022-01-21 转载在 其他  
字(6.3k)|赞(0)|评价(0)|浏览(131)

本文整理了Java中javax.swing.JMenu.getModel()方法的一些代码示例,展示了JMenu.getModel()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。JMenu.getModel()方法的具体详情如下:
包路径:javax.swing.JMenu
类名称:JMenu
方法名:getModel

JMenu.getModel介绍

暂无

代码示例

代码示例来源:origin: com.github.insubstantial/substance

public SubstanceMenuUI(JMenu menuItem) {
  this.stateTransitionTracker = new StateTransitionTracker(menuItem,
      menuItem.getModel());
}

代码示例来源:origin: com.jidesoft/jide-oss

@Override
  public boolean isEnabled() {
    return menu.getModel().isEnabled();
  }
}

代码示例来源:origin: com.jidesoft/jide-oss

@Override
  public boolean isEnabled() {
    return menu.getModel().isEnabled();
  }
}

代码示例来源:origin: com.jidesoft/jide-oss

@Override
  public boolean isEnabled() {
    return menu.getModel().isEnabled();
  }
}

代码示例来源:origin: org.java.net.substance/substance

public SubstanceMenuUI(JMenu menuItem) {
  this.stateTransitionTracker = new StateTransitionTracker(menuItem,
      menuItem.getModel());
}

代码示例来源:origin: net.sf.squirrel-sql.thirdparty-non-maven/toniclf

public boolean isEnabled() {
   return menu.getModel().isEnabled();
}
 }

代码示例来源:origin: net.sf.squirrel-sql.thirdparty-non-maven/toniclf

public void componentAdded(ContainerEvent e)
{
  Component c= e.getChild();
  if (c instanceof JMenu)
     ((JMenu) c).getModel().addChangeListener(changeListener);
}
public void componentRemoved(ContainerEvent e)

代码示例来源:origin: net.sf.squirrel-sql.thirdparty-non-maven/toniclf

public void componentRemoved(ContainerEvent e)
  {
    Component c= e.getChild();
    if (c instanceof JMenu)
       ((JMenu) c).getModel().removeChangeListener(changeListener);
  }
}

代码示例来源:origin: com.jtattoo/JTattoo

public void mouseExited(MouseEvent evt) {
    super.mouseExited(evt);
    JMenu menu = (JMenu) evt.getSource();
    ButtonModel model = menu.getModel();
    if (menu.isRolloverEnabled()) {
      model.setRollover(false);
      menuItem.repaint();
    }
  }
}

代码示例来源:origin: com.jtattoo/JTattoo

public void mouseEntered(MouseEvent evt) {
  super.mouseEntered(evt);
  JMenu menu = (JMenu) evt.getSource();
  if (menu.isTopLevelMenu() && menu.isRolloverEnabled()) {
    menu.getModel().setRollover(true);
    menuItem.repaint();
  }
}

代码示例来源:origin: com.jidesoft/jide-oss

menu.getModel().setPressed(false);
menu.getModel().setArmed(false);
menu.getModel().setArmed(false);
menu.getModel().setPressed(false);
MenuElement menuElement = menuElements[i];
if (menuElement instanceof JPopupMenu && ((JPopupMenu) menuElement).isAncestorOf(menu)) {
  menu.getModel().setRollover(false);
  setMouseOver(false);
  manager.clearSelectedPath();

代码示例来源:origin: com.jidesoft/jide-oss

menu.getModel().setPressed(false);
menu.getModel().setArmed(false);
menu.getModel().setArmed(false);
menu.getModel().setPressed(false);
MenuElement menuElement = menuElements[i];
if (menuElement instanceof JPopupMenu && ((JPopupMenu) menuElement).isAncestorOf(menu)) {
  menu.getModel().setRollover(false);
  setMouseOver(false);
  manager.clearSelectedPath();

代码示例来源:origin: net.sf.nimrod/nimrod-laf

public void update( Graphics g, JComponent c) {
 JMenu menu = (JMenu)c;
 if ( menu.isTopLevelMenu() ) {
  menu.setOpaque( false);
  
  ButtonModel model = menu.getModel();
  if ( model.isArmed() || model.isSelected() ) {
   g.setColor( NimRODLookAndFeel.getFocusColor());
   g.fillRoundRect( 1,1, c.getWidth()-2, c.getHeight()-3, 2,2);
  }
 }
 else {
  menuItem.setBorderPainted( false);
  menuItem.setOpaque( false);
 }
 
 super.update( g, c);
}

代码示例来源:origin: com.jidesoft/jide-oss

menu.getModel().setPressed(false);
menu.getModel().setArmed(false);
menu.getModel().setArmed(false);
menu.getModel().setPressed(false);
MenuElement menuElement = menuElements[i];
if (menuElement instanceof JPopupMenu && ((JPopupMenu) menuElement).isAncestorOf(menu)) {
  menu.getModel().setRollover(false);
  setMouseOver(false);
  manager.clearSelectedPath();

代码示例来源:origin: net.sf.squirrel-sql.thirdparty-non-maven/toniclf

/**	Uninstalls any registered listeners for the associated menu bar */
protected void uninstallListeners()
{
  menuBar.removeContainerListener(containerListener);
  menuBar.removePropertyChangeListener(propertyChangeListener);
  for (int i= 0; i < menuBar.getMenuCount(); i++)
  {
    JMenu menu= menuBar.getMenu(i);
    if (menu != null)
      menu.getModel().removeChangeListener(changeListener);
  }
  containerListener= null;
  changeListener= null;
  propertyChangeListener= null;
}

代码示例来源:origin: com.jidesoft/jide-oss

/**
 * Invoked when the mouse has been clicked on the menu. This method clears or sets the selection path of the
 * MenuSelectionManager.
 *
 * @param e the mouse event
 */
public void mousePressed(MouseEvent e) {
  JMenu menu = (JMenu) menuItem;
  if (!menu.isEnabled())
    return;
  setMouseOver(true);
  if (!SwingUtilities.isLeftMouseButton(e)) {
    return;
  }
  if (isClickOnButton(e, menu)) {
    if (((JideSplitButton) menuItem).isButtonEnabled()) {
      // click button
      menu.getModel().setArmed(true);
      menu.getModel().setPressed(true);
    }
    if (!menu.hasFocus() && menu.isRequestFocusEnabled()) {
      menu.requestFocus();
    }
  }
  else {
    downButtonPressed(menu);
  }
}

代码示例来源:origin: com.jidesoft/jide-oss

/**
 * Invoked when the mouse has been clicked on the menu. This method clears or sets the selection path of the
 * MenuSelectionManager.
 *
 * @param e the mouse event
 */
public void mousePressed(MouseEvent e) {
  JMenu menu = (JMenu) menuItem;
  if (!menu.isEnabled())
    return;
  setMouseOver(true);
  if (!SwingUtilities.isLeftMouseButton(e)) {
    return;
  }
  if (isClickOnButton(e, menu)) {
    if (((JideSplitButton) menuItem).isButtonEnabled()) {
      // click button
      menu.getModel().setArmed(true);
      menu.getModel().setPressed(true);
    }
    if (!menu.hasFocus() && menu.isRequestFocusEnabled()) {
      menu.requestFocus();
    }
  }
  else {
    downButtonPressed(menu);
  }
}

代码示例来源:origin: com.jidesoft/jide-oss

/**
 * Invoked when the mouse has been clicked on the menu. This method clears or sets the selection path of the
 * MenuSelectionManager.
 *
 * @param e the mouse event
 */
public void mousePressed(MouseEvent e) {
  JMenu menu = (JMenu) menuItem;
  if (!menu.isEnabled())
    return;
  setMouseOver(true);
  if (!SwingUtilities.isLeftMouseButton(e)) {
    return;
  }
  if (isClickOnButton(e, menu)) {
    if (((JideSplitButton) menuItem).isButtonEnabled()) {
      // click button
      menu.getModel().setArmed(true);
      menu.getModel().setPressed(true);
    }
    if (!menu.hasFocus() && menu.isRequestFocusEnabled()) {
      menu.requestFocus();
    }
  }
  else {
    downButtonPressed(menu);
  }
}

代码示例来源:origin: net.sf.squirrel-sql.thirdparty-non-maven/toniclf

/**	Installs listeners for the associated menu bar */
protected void installListeners()
{
  containerListener= createContainerListener();
  changeListener= createChangeListener();
  propertyChangeListener= createPropertyChangeListener();
  for (int i= 0; i < menuBar.getMenuCount(); i++)
  {
    JMenu menu= menuBar.getMenu(i);
    if (menu != null)
      menu.getModel().addChangeListener(changeListener);
  }
  menuBar.addContainerListener(containerListener);
  menuBar.addPropertyChangeListener(propertyChangeListener);
}

相关文章