Java Code Examples for javax.swing.JLabel#getDisplayedMnemonicIndex()

The following examples show how to use javax.swing.JLabel#getDisplayedMnemonicIndex() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: WindowsLabelUI.java    From jdk8u60 with GNU General Public License v2.0 5 votes vote down vote up
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);
    }
}
 
Example 2
Source File: WindowsLabelUI.java    From jdk8u-jdk with GNU General Public License v2.0 5 votes vote down vote up
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);
}
 
Example 3
Source File: WindowsLabelUI.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
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);
    }
}
 
Example 4
Source File: WindowsLabelUI.java    From jdk8u-jdk with GNU General Public License v2.0 5 votes vote down vote up
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);
    }
}
 
Example 5
Source File: WindowsLabelUI.java    From jdk8u-jdk with GNU General Public License v2.0 5 votes vote down vote up
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);
    }
}
 
Example 6
Source File: WindowsLabelUI.java    From jdk8u_jdk with GNU General Public License v2.0 5 votes vote down vote up
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);
    }
}
 
Example 7
Source File: WindowsLabelUI.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
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);
    }
}
 
Example 8
Source File: WindowsLabelUI.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
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);
}
 
Example 9
Source File: WindowsLabelUI.java    From JDKSourceCode1.8 with MIT License 5 votes vote down vote up
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);
    }
}
 
Example 10
Source File: WindowsLabelUI.java    From JDKSourceCode1.8 with MIT License 5 votes vote down vote up
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);
}
 
Example 11
Source File: WindowsLabelUI.java    From openjdk-8 with GNU General Public License v2.0 5 votes vote down vote up
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);
    }
}
 
Example 12
Source File: WindowsLabelUI.java    From jdk8u-dev-jdk with GNU General Public License v2.0 5 votes vote down vote up
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);
}
 
Example 13
Source File: WindowsLabelUI.java    From jdk8u-dev-jdk with GNU General Public License v2.0 5 votes vote down vote up
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);
    }
}
 
Example 14
Source File: WindowsLabelUI.java    From TencentKona-8 with GNU General Public License v2.0 5 votes vote down vote up
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);
}
 
Example 15
Source File: WindowsLabelUI.java    From dragonwell8_jdk with GNU General Public License v2.0 5 votes vote down vote up
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);
    }
}
 
Example 16
Source File: WindowsLabelUI.java    From dragonwell8_jdk with GNU General Public License v2.0 5 votes vote down vote up
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);
}
 
Example 17
Source File: WindowsLabelUI.java    From openjdk-8-source with GNU General Public License v2.0 5 votes vote down vote up
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);
}
 
Example 18
Source File: WindowsLabelUI.java    From hottub with GNU General Public License v2.0 5 votes vote down vote up
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);
    }
}
 
Example 19
Source File: WindowsLabelUI.java    From jdk1.8-source-analysis with Apache License 2.0 5 votes vote down vote up
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);
    }
}
 
Example 20
Source File: FlatBusyLabelUI.java    From FlatLaf with Apache License 2.0 4 votes vote down vote up
@Override
protected void paintDisabledText( JLabel l, Graphics g, String s, int textX, int textY ) {
	int mnemIndex = FlatLaf.isShowMnemonics() ? l.getDisplayedMnemonicIndex() : -1;
	g.setColor( disabledForeground );
	FlatUIUtils.drawStringUnderlineCharAt( l, g, s, mnemIndex, textX, textY );
}