Esempio n. 1
0
 /**
  * Performs enabled text painting.
  *
  * @param label label to process
  * @param g2d graphics context
  * @param text label text
  * @param textX text X coordinate
  * @param textY text Y coordinate
  */
 protected void paintEnabledText(
     final E label, final Graphics2D g2d, final String text, final int textX, final int textY) {
   if (drawShade) {
     g2d.setColor(label.getForeground());
     paintShadowText(g2d, text, textX, textY);
   } else {
     final int mnemIndex = label.getDisplayedMnemonicIndex();
     g2d.setColor(label.getForeground());
     SwingUtils.drawStringUnderlineCharAt(g2d, text, mnemIndex, textX, textY);
   }
 }
Esempio n. 2
0
 /**
  * Performs disabled text painting.
  *
  * @param label label to process
  * @param g2d graphics context
  * @param text label text
  * @param textX text X coordinate
  * @param textY text Y coordinate
  */
 protected void paintDisabledText(
     final E label, final Graphics2D g2d, final String text, final int textX, final int textY) {
   if (label.isEnabled() && drawShade) {
     g2d.setColor(label.getBackground().darker());
     paintShadowText(g2d, text, textX, textY);
   } else {
     final int accChar = label.getDisplayedMnemonicIndex();
     final Color background = label.getBackground();
     g2d.setColor(background.brighter());
     SwingUtils.drawStringUnderlineCharAt(g2d, text, accChar, textX + 1, textY + 1);
     g2d.setColor(background.darker());
     SwingUtils.drawStringUnderlineCharAt(g2d, text, accChar, textX, textY);
   }
 }