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

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

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

JMenuItem.getDisplayedMnemonicIndex介绍

暂无

代码示例

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

int mnemIndex= menuItem.getDisplayedMnemonicIndex();

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

int mnemonicIndex = menuItem.getDisplayedMnemonicIndex();

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

int mnemonicIndex = menuItem.getDisplayedMnemonicIndex();

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

ButtonModel model = menuItem.getModel();
FontMetrics fm = g.getFontMetrics();
int mnemIndex = menuItem.getDisplayedMnemonicIndex();

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

ButtonModel model = menuItem.getModel();
FontMetrics fm = g.getFontMetrics();
int mnemIndex = menuItem.getDisplayedMnemonicIndex();

代码示例来源: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.jidesoft/jide-oss

int mnemonicIndex = menuItem.getDisplayedMnemonicIndex();

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

int mnemIndex = menuItem.getDisplayedMnemonicIndex();
if (!model.isEnabled()) {

代码示例来源: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.jidesoft/jide-oss

int mnemonicIndex = menuItem.getDisplayedMnemonicIndex();

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

int mnemonicIndex = menuItem.getDisplayedMnemonicIndex();

代码示例来源:origin: khuxtable/seaglass

static void paintText(Graphics g, SeaGlassMenuItemLayoutHelper lh,
           MenuItemLayoutHelper.LayoutResult lr) {
  if (!lh.getText().equals("")) {
    if (lh.getHtmlView() != null) {
      // Text is HTML
      lh.getHtmlView().paint(g, lr.getTextRect());
    } else {
      // Text isn't HTML
      g.setColor(lh.getStyle().getColor(
          lh.getContext(), ColorType.TEXT_FOREGROUND));
      g.setFont(lh.getStyle().getFont(lh.getContext()));
      lh.getGraphicsUtils().paintText(lh.getContext(), g, lh.getText(),
          lr.getTextRect().x, lr.getTextRect().y,
          lh.getMenuItem().getDisplayedMnemonicIndex());
    }
  }
}

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

SubstanceTextUtilities.paintText(graphics, menuItem,
    mli.textRect, mli.text, menuItem
        .getDisplayedMnemonicIndex());

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

SubstanceTextUtilities.paintText(graphics, menuItem,
    mli.textRect, mli.text, menuItem
        .getDisplayedMnemonicIndex());

代码示例来源:origin: khuxtable/seaglass

g.setColor(style.getColor(context, ColorType.TEXT_FOREGROUND));
g.setFont(style.getFont(context));
style.getGraphicsUtils(context).paintText(context, g, text, textRect.x, textRect.y, b.getDisplayedMnemonicIndex());

相关文章

JMenuItem类方法