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

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

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

JLabel.getDisplayedMnemonicIndex介绍

暂无

代码示例

代码示例来源:origin: de.sciss/submin

@Override
  protected void paintDisabledText(final E label, final Graphics2D g2d, final String text, final int textX, final int textY) {
    final int accChar = label.getDisplayedMnemonicIndex();
    g2d.setPaint(disabledForeground);
    SwingUtils.drawStringUnderlineCharAt(g2d, text, accChar, textX, textY);
  }
}

代码示例来源:origin: xyz.cofe/gui.swing

public int getTabDisplayedMnemonicIndex() {
  if (isClosed())
    return -1;
  return titleLabel.getDisplayedMnemonicIndex();
}// </editor-fold>

代码示例来源:origin: org.opentcs.thirdparty.jhotdraw/jhotdraw

@Override
protected void paintEnabledText(JLabel l, Graphics g, String s, int textX, int textY) {
  int mnemIndex = l.getDisplayedMnemonicIndex();
  String style = (String) l.getClientProperty("Quaqua.Label.style");
  if (style != null) {
    if (style.equals("emboss") &&
        UIManager.getColor("Label.embossForeground") != null) {
      g.setColor(UIManager.getColor("Label.embossForeground"));
      PaletteUtilities.drawString(g, s, mnemIndex, textX, textY + 1);
    } else if (style.equals("shadow") &&
        UIManager.getColor("Label.shadowForeground") != null) {
      g.setColor(UIManager.getColor("Label.shadowForeground"));
      PaletteUtilities.drawString(g, s, mnemIndex, textX, textY + 1);
    }
  }
  g.setColor(l.getForeground());
  PaletteUtilities.drawString(g, s, mnemIndex, textX, textY);
//SwingUtilities2.drawStringUnderlineCharAt(l, g, s, mnemIndex,
//                                             textX, textY);
}

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

protected void paintDisabledText(JLabel l, Graphics g, String s, int textX, int textY) {
    int mnemIndex = -1;
    if (JTattooUtilities.getJavaVersion() >= 1.4) {
      mnemIndex = l.getDisplayedMnemonicIndex();
    } else {
      mnemIndex = JTattooUtilities.findDisplayedMnemonicIndex(l.getText(), l.getDisplayedMnemonic());
    }
    g.setColor(Color.black);
    JTattooUtilities.drawStringUnderlineCharAt(l, g, s, mnemIndex, textX + 1, textY + 1);
    g.setColor(AbstractLookAndFeel.getDisabledForegroundColor());
    JTattooUtilities.drawStringUnderlineCharAt(l, g, s, mnemIndex, textX, textY);
  }
}

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

protected void paintDisabledText(JLabel l, Graphics g, String s, int textX, int textY) {
    int mnemIndex;
    if (JTattooUtilities.getJavaVersion() >= 1.4) {
      mnemIndex = l.getDisplayedMnemonicIndex();
    } else {
      mnemIndex = JTattooUtilities.findDisplayedMnemonicIndex(l.getText(), l.getDisplayedMnemonic());
    }
    g.setColor(Color.white);
    JTattooUtilities.drawStringUnderlineCharAt(l, g, s, mnemIndex, textX + 1, textY + 1);
    g.setColor(AbstractLookAndFeel.getDisabledForegroundColor());
    JTattooUtilities.drawStringUnderlineCharAt(l, g, s, mnemIndex, textX, textY);
  }
}

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

protected void paintEnabledText(JLabel l, Graphics g, String s, int textX, int textY) {
  int mnemIndex;
  if (JTattooUtilities.getJavaVersion() >= 1.4) {
    mnemIndex = l.getDisplayedMnemonicIndex();
  } else {
    mnemIndex = JTattooUtilities.findDisplayedMnemonicIndex(l.getText(), l.getDisplayedMnemonic());
  }
  Object sc = l.getClientProperty("shadowColor");
  if (sc instanceof Color) {
    g.setColor((Color)sc);
    JTattooUtilities.drawStringUnderlineCharAt(l, g, s, mnemIndex, textX, textY + 1);
  }
  g.setColor(l.getForeground());
  JTattooUtilities.drawStringUnderlineCharAt(l, g, s, mnemIndex, textX, textY);
}

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

protected void paintDisabledText(JLabel l, Graphics g, String s, int textX, int textY) {
  int mnemIndex = -1;
  if (JTattooUtilities.getJavaVersion() >= 1.4) {
    mnemIndex = l.getDisplayedMnemonicIndex();
  } else {
    mnemIndex = JTattooUtilities.findDisplayedMnemonicIndex(l.getText(), l.getDisplayedMnemonic());
  }
  Graphics2D g2D = (Graphics2D) g;
  Composite savedComposite = g2D.getComposite();
  AlphaComposite alpha = AlphaComposite.getInstance(AlphaComposite.SRC_OVER, 0.8f);
  g2D.setComposite(alpha);
  Color fc = l.getForeground();
  if (ColorHelper.getGrayValue(fc) > 164) {
    fc = ColorHelper.brighter(AbstractLookAndFeel.getDisabledForegroundColor(), 40);
    g.setColor(Color.black);
  } else {
    fc = AbstractLookAndFeel.getDisabledForegroundColor();
    g.setColor(Color.white);
  }
  JTattooUtilities.drawStringUnderlineCharAt(l, g, s, mnemIndex, textX, textY + 1);
  g2D.setComposite(savedComposite);
  g.setColor(fc);
  JTattooUtilities.drawStringUnderlineCharAt(l, g, s, mnemIndex, textX, textY);
}

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

protected void paintEnabledText(JLabel l, Graphics g, String s, int textX, int textY) {
  int mnemIndex = -1;
  if (JTattooUtilities.getJavaVersion() >= 1.4) {
    mnemIndex = l.getDisplayedMnemonicIndex();
  } else {
    mnemIndex = JTattooUtilities.findDisplayedMnemonicIndex(l.getText(), l.getDisplayedMnemonic());
  }
  Color fc = l.getForeground();
  if (AbstractLookAndFeel.getTheme().isTextShadowOn() && ColorHelper.getGrayValue(fc) > 128) {
    g.setColor(Color.black);
    JTattooUtilities.drawStringUnderlineCharAt(l, g, s, mnemIndex, textX + 1, textY + 1);
  }
  g.setColor(fc);
  JTattooUtilities.drawStringUnderlineCharAt(l, g, s, mnemIndex, textX, textY);
}

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

protected void paintEnabledText(JLabel l, Graphics g, String s, int textX, int textY) {
  int mnemIndex = -1;
  if (JTattooUtilities.getJavaVersion() >= 1.4) {
    mnemIndex = l.getDisplayedMnemonicIndex();
  } else {
    mnemIndex = JTattooUtilities.findDisplayedMnemonicIndex(l.getText(), l.getDisplayedMnemonic());
  }
  Color fc = l.getForeground();
  if (AbstractLookAndFeel.getTheme().isTextShadowOn() && ColorHelper.getGrayValue(fc) > 164) {
    g.setColor(Color.black);
    JTattooUtilities.drawStringUnderlineCharAt(l, g, s, mnemIndex, textX, textY + 1);
  } else {
    Object sc = l.getClientProperty("shadowColor");
    if (sc instanceof Color) {
      g.setColor((Color)sc);
      JTattooUtilities.drawStringUnderlineCharAt(l, g, s, mnemIndex, textX, textY + 1);
    }
  }
  g.setColor(fc);
  JTattooUtilities.drawStringUnderlineCharAt(l, g, s, mnemIndex, textX, textY);
}

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

protected void paint(SeaGlassContext context, Graphics g) {
  JLabel label = (JLabel) context.getComponent();
  Icon icon = (label.isEnabled()) ? label.getIcon() : label.getDisabledIcon();
  g.setColor(context.getStyle().getColor(context, ColorType.TEXT_FOREGROUND));
  g.setFont(style.getFont(context));
  context.getStyle().getGraphicsUtils(context).paintText(context, g, label.getText(), icon, label.getHorizontalAlignment(),
    label.getVerticalAlignment(), label.getHorizontalTextPosition(), label.getVerticalTextPosition(),
    label.getIconTextGap(), label.getDisplayedMnemonicIndex(), 0);
}

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

clippedText, label.getDisplayedMnemonicIndex(),
labelState, labelAlpha);

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

clippedText, label.getDisplayedMnemonicIndex(),
labelState, labelAlpha);

代码示例来源:origin: org.netbeans.api/org-openide-explorer

int mnemonicIndex = lbl.getDisplayedMnemonicIndex();

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

public Dimension getMaximumSize(JComponent c) {
  JLabel label = (JLabel) c;
  Icon icon = (label.isEnabled()) ? label.getIcon() : label.getDisabledIcon();
  SeaGlassContext context = getContext(c);
  Dimension size = context.getStyle().getGraphicsUtils(context).getMaximumSize(context, context.getStyle().getFont(context),
    label.getText(), icon, label.getHorizontalAlignment(), label.getVerticalAlignment(), label.getHorizontalTextPosition(),
    label.getVerticalTextPosition(), label.getIconTextGap(), label.getDisplayedMnemonicIndex());
  context.dispose();
  return size;
}

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

public Dimension getMinimumSize(JComponent c) {
  JLabel label = (JLabel) c;
  Icon icon = (label.isEnabled()) ? label.getIcon() : label.getDisabledIcon();
  SeaGlassContext context = getContext(c);
  Dimension size = context.getStyle().getGraphicsUtils(context).getMinimumSize(context, context.getStyle().getFont(context),
    label.getText(), icon, label.getHorizontalAlignment(), label.getVerticalAlignment(), label.getHorizontalTextPosition(),
    label.getVerticalTextPosition(), label.getIconTextGap(), label.getDisplayedMnemonicIndex());
  context.dispose();
  return size;
}

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

public Dimension getPreferredSize(JComponent c) {
  JLabel label = (JLabel) c;
  Icon icon = (label.isEnabled()) ? label.getIcon() : label.getDisabledIcon();
  SeaGlassContext context = getContext(c);
  Dimension size = context.getStyle().getGraphicsUtils(context).getPreferredSize(context,
    context.getStyle().getFont(context), label.getText(), icon, label.getHorizontalAlignment(),
    label.getVerticalAlignment(), label.getHorizontalTextPosition(), label.getVerticalTextPosition(),
    label.getIconTextGap(), label.getDisplayedMnemonicIndex());
  context.dispose();
  return size;
}

代码示例来源:origin: org.netbeans.modules/org-netbeans-modules-swingapp

Mnemonics.setLocalizedText(label, text);
int mnem = label.getDisplayedMnemonic();
int mnemIndex = label.getDisplayedMnemonicIndex();
putValue(Action.NAME, label.getText());
if (mnem != 0) {

相关文章

JLabel类方法