本文整理汇总了Java中javax.swing.JLabel.getDisplayedMnemonicIndex方法的典型用法代码示例。如果您正苦于以下问题:Java JLabel.getDisplayedMnemonicIndex方法的具体用法?Java JLabel.getDisplayedMnemonicIndex怎么用?Java JLabel.getDisplayedMnemonicIndex使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类javax.swing.JLabel
的用法示例。
在下文中一共展示了JLabel.getDisplayedMnemonicIndex方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: paintEnabledText
import javax.swing.JLabel; //导入方法依赖的package包/类
protected void paintEnabledText(JLabel l, Graphics g, String s,
int textX, int textY) {
int mnemonicIndex = l.getDisplayedMnemonicIndex();
// W2K Feature: Check to see if the Underscore should be rendered.
if (WindowsLookAndFeel.isMnemonicHidden() == true) {
mnemonicIndex = -1;
}
g.setColor(l.getForeground());
SwingUtilities2.drawStringUnderlineCharAt(l, g, s, mnemonicIndex,
textX, textY);
}
示例2: paintDisabledText
import javax.swing.JLabel; //导入方法依赖的package包/类
protected void paintDisabledText(JLabel l, Graphics g, String s,
int textX, int textY) {
int mnemonicIndex = l.getDisplayedMnemonicIndex();
// W2K Feature: Check to see if the Underscore should be rendered.
if (WindowsLookAndFeel.isMnemonicHidden() == true) {
mnemonicIndex = -1;
}
if ( UIManager.getColor("Label.disabledForeground") instanceof Color &&
UIManager.getColor("Label.disabledShadow") instanceof Color) {
g.setColor( UIManager.getColor("Label.disabledShadow") );
SwingUtilities2.drawStringUnderlineCharAt(l, g, s,
mnemonicIndex,
textX + 1, textY + 1);
g.setColor( UIManager.getColor("Label.disabledForeground") );
SwingUtilities2.drawStringUnderlineCharAt(l, g, s,
mnemonicIndex,
textX, textY);
} else {
Color background = l.getBackground();
g.setColor(background.brighter());
SwingUtilities2.drawStringUnderlineCharAt(l,g, s, mnemonicIndex,
textX + 1, textY + 1);
g.setColor(background.darker());
SwingUtilities2.drawStringUnderlineCharAt(l,g, s, mnemonicIndex,
textX, textY);
}
}