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

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

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

JMenuItem.getModel介绍

暂无

代码示例

代码示例来源:origin: nodebox/nodebox

public void setShowConsoleChecked(boolean checked) {
  showConsoleItem.getModel().setSelected(checked);
}

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

/**
 * Set the temporary flag to indicate if the mouse has entered the menu.
 */
protected void setMouseOver(boolean over) {
  isMouseOver = over;
  menuItem.getModel().setRollover(isMouseOver);
}

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

/**
 * Set the temporary flag to indicate if the mouse has entered the menu.
 *
 * @param over the flag
 */
protected void setMouseOver(boolean over) {
  isMouseOver = over;
  menuItem.getModel().setRollover(isMouseOver);
}

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

/**
 * Set the temporary flag to indicate if the mouse has entered the menu.
 */
protected void setMouseOver(boolean over) {
  isMouseOver = over;
  menuItem.getModel().setRollover(isMouseOver);
}

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

public SubstanceMenuItemUI(JMenuItem menuItem) {
  this.stateTransitionTracker = new StateTransitionTracker(menuItem,
      menuItem.getModel());
}

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

public void paintBorder( Component c, Graphics g, int x, int y, int width, int height) {
 JMenuItem b = (JMenuItem)c;
 ButtonModel model = b.getModel();
 
 if ( model.isArmed() || model.isSelected() ) {
  super.paintBorder( c, g, x, y, width, height-2);
 }
}

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

@Override
public void mouseEntered(MouseEvent e) {
  this.stateTransitionTracker.turnOffModelChangeTracking();
  try {
    this.isMouseInside = true;
    this.item.getModel().setRollover(true);
  } finally {
    this.stateTransitionTracker.onModelStateChanged();
  }
}

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

@Override
public void mouseReleased(MouseEvent e) {
  this.stateTransitionTracker.turnOffModelChangeTracking();
  try {
    ButtonModel model = this.item.getModel();
    model.setRollover(false);
  } finally {
    this.stateTransitionTracker.onModelStateChanged();
  }
}

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

public void mouseReleased(MouseEvent e) {
  this.stateTransitionTracker.turnOffModelChangeTracking();
  try {
    ButtonModel model = this.item.getModel();
    model.setRollover(false);
  } finally {
    this.stateTransitionTracker.onModelStateChanged();
  }
}

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

public void mouseMoved(MouseEvent e) {
  this.stateTransitionTracker.turnOffModelChangeTracking();
  try {
    this.item.getModel().setRollover(this.isMouseInside);
  } finally {
    this.stateTransitionTracker.onModelStateChanged();
  }
}

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

@Override
public void mouseExited(MouseEvent e) {
  this.stateTransitionTracker.turnOffModelChangeTracking();
  try {
    this.isMouseInside = false;
    this.item.getModel().setRollover(false);
  } finally {
    this.stateTransitionTracker.onModelStateChanged();
  }
}

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

@Override
public void mouseMoved(MouseEvent e) {
  this.stateTransitionTracker.turnOffModelChangeTracking();
  try {
    this.item.getModel().setRollover(this.isMouseInside);
  } finally {
    this.stateTransitionTracker.onModelStateChanged();
  }
}

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

public void mouseEntered(MouseEvent e) {
  this.stateTransitionTracker.turnOffModelChangeTracking();
  try {
    this.isMouseInside = true;
    this.item.getModel().setRollover(true);
  } finally {
    this.stateTransitionTracker.onModelStateChanged();
  }
}

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

public void mouseExited(MouseEvent e) {
  this.stateTransitionTracker.turnOffModelChangeTracking();
  try {
    this.isMouseInside = false;
    this.item.getModel().setRollover(false);
  } finally {
    this.stateTransitionTracker.onModelStateChanged();
  }
}

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

public void stateChanged(ChangeEvent e) {
    if (e.getSource() instanceof JMenuItem) {
      if (((JMenuItem) e.getSource()).getModel().isArmed()) {
        popupMenu.scrollRectToVisible(((JMenuItem) e.getSource()).getBounds());
        Point position = contents.getViewport().getViewPosition();
        contents.getScrollUpButton().setEnabled(position.y > 2);
        contents.getScrollDownButton().setEnabled(position.y < contents.getViewport().getViewSize().height - contents.getViewport().getViewRect().height - 2);
      }
    }
  }
});

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

protected void paintBackground(Graphics g, JComponent c, int x, int y, int w, int h) {
  JMenuItem mi = (JMenuItem) c;
  ButtonModel model = mi.getModel();
  if (model.isArmed() || (c instanceof JMenu && model.isSelected())) {
    JTattooUtilities.fillHorGradient(g, AbstractLookAndFeel.getTheme().getMenuSelectionColors(), x, y, w, h);
  } else {
    super.paintBackground(g, c, x, y, w, h);
  }
}

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

protected void paintBackground(Graphics g, JComponent c, int x, int y, int w, int h) {
  JMenuItem mi = (JMenuItem) c;
  ButtonModel model = mi.getModel();
  if (model.isArmed() || (c instanceof JMenu && model.isSelected())) {
    JTattooUtilities.fillHorGradient(g, AbstractLookAndFeel.getTheme().getMenuSelectionColors(), x, y, w, h);
  } else {
    super.paintBackground(g, c, x, y, w, h);
  }
}

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

protected void paintBackground(Graphics g, JComponent c, int x, int y, int w, int h) {
  JMenuItem mi = (JMenuItem) c;
  ButtonModel model = mi.getModel();
  if (model.isArmed() || (c instanceof JMenu && model.isSelected())) {
    JTattooUtilities.fillHorGradient(g, AbstractLookAndFeel.getTheme().getMenuSelectionColors(), x, y, w, h);
  } else {
    super.paintBackground(g, c, x, y, w, h);
  } 
}

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

protected void paintBackground(Graphics g, JComponent c, int x, int y, int w, int h) {
  JMenuItem mi = (JMenuItem) c;
  ButtonModel model = mi.getModel();
  if (model.isArmed() || (c instanceof JMenu && model.isSelected())) {
    TextureUtils.fillComponent(g, c, TextureUtils.ROLLOVER_TEXTURE_TYPE);
  } else {
    if (!(mi.getBackground() instanceof ColorUIResource)) {
      super.paintBackground(g, c, x, y, w, h);
    } else {
      TextureUtils.fillComponent(g, c, TextureUtils.MENUBAR_TEXTURE_TYPE);
    }
  }
}

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

protected void paintBackground(Graphics g, JComponent c, int x, int y, int w, int h) {
  JMenuItem mi = (JMenuItem) c;
  ButtonModel model = mi.getModel();
  if (model.isArmed() || (c instanceof JMenu && model.isSelected())) {
    TextureUtils.fillComponent(g, c, TextureUtils.ROLLOVER_TEXTURE_TYPE);
  } else {
    if (!(mi.getBackground() instanceof ColorUIResource)) {
      super.paintBackground(g, c, x, y, w, h);
    } else {
      TextureUtils.fillComponent(g, c, TextureUtils.MENUBAR_TEXTURE_TYPE);
    }
  }
}

相关文章

JMenuItem类方法