< prev index next >

src/java.desktop/macosx/classes/com/apple/laf/AquaTabbedPaneContrastUI.java

Print this page




  54             return;
  55         }
  56 
  57         if (title == null) return;
  58 
  59         final Color color = tabPane.getForegroundAt(tabIndex);
  60         if (color instanceof UIResource) {
  61             g2d.setColor(getNonSelectedTabTitleColor());
  62             if (tabPane.getSelectedIndex() == tabIndex) {
  63                 boolean pressed = isPressedAt(tabIndex);
  64                 boolean enabled = tabPane.isEnabled() && tabPane.isEnabledAt(tabIndex);
  65                 Color textColor = getSelectedTabTitleColor(enabled, pressed);
  66                 Color shadowColor = getSelectedTabTitleShadowColor(enabled);
  67                 AquaUtils.paintDropShadowText(g2d, tabPane, font, metrics, textRect.x, textRect.y, 0, 1, textColor, shadowColor, title);
  68                 return;
  69             }
  70         } else {
  71             g2d.setColor(color);
  72         }
  73         g2d.setFont(font);
  74         SwingUtilities2.drawString(tabPane, g2d, title, textRect.x, textRect.y + metrics.getAscent());
  75     }
  76 
  77     protected static Color getSelectedTabTitleColor(boolean enabled, boolean pressed) {
  78         if (enabled && pressed) {
  79             return UIManager.getColor("TabbedPane.selectedTabTitlePressedColor");
  80         } else if (!enabled) {
  81             return UIManager.getColor("TabbedPane.selectedTabTitleDisabledColor");
  82         } else {
  83             return UIManager.getColor("TabbedPane.selectedTabTitleNormalColor");
  84         }
  85     }
  86 
  87     protected static Color getSelectedTabTitleShadowColor(boolean enabled) {
  88         return enabled ? UIManager.getColor("TabbedPane.selectedTabTitleShadowNormalColor") : UIManager.getColor("TabbedPane.selectedTabTitleShadowDisabledColor");
  89     }
  90 
  91     protected static Color getNonSelectedTabTitleColor() {
  92         return UIManager.getColor("TabbedPane.nonSelectedTabTitleNormalColor");
  93     }
  94 




  54             return;
  55         }
  56 
  57         if (title == null) return;
  58 
  59         final Color color = tabPane.getForegroundAt(tabIndex);
  60         if (color instanceof UIResource) {
  61             g2d.setColor(getNonSelectedTabTitleColor());
  62             if (tabPane.getSelectedIndex() == tabIndex) {
  63                 boolean pressed = isPressedAt(tabIndex);
  64                 boolean enabled = tabPane.isEnabled() && tabPane.isEnabledAt(tabIndex);
  65                 Color textColor = getSelectedTabTitleColor(enabled, pressed);
  66                 Color shadowColor = getSelectedTabTitleShadowColor(enabled);
  67                 AquaUtils.paintDropShadowText(g2d, tabPane, font, metrics, textRect.x, textRect.y, 0, 1, textColor, shadowColor, title);
  68                 return;
  69             }
  70         } else {
  71             g2d.setColor(color);
  72         }
  73         g2d.setFont(font);
  74         textUIDrawing.drawString(tabPane, g2d, title, textRect.x, textRect.y + metrics.getAscent());
  75     }
  76 
  77     protected static Color getSelectedTabTitleColor(boolean enabled, boolean pressed) {
  78         if (enabled && pressed) {
  79             return UIManager.getColor("TabbedPane.selectedTabTitlePressedColor");
  80         } else if (!enabled) {
  81             return UIManager.getColor("TabbedPane.selectedTabTitleDisabledColor");
  82         } else {
  83             return UIManager.getColor("TabbedPane.selectedTabTitleNormalColor");
  84         }
  85     }
  86 
  87     protected static Color getSelectedTabTitleShadowColor(boolean enabled) {
  88         return enabled ? UIManager.getColor("TabbedPane.selectedTabTitleShadowNormalColor") : UIManager.getColor("TabbedPane.selectedTabTitleShadowDisabledColor");
  89     }
  90 
  91     protected static Color getNonSelectedTabTitleColor() {
  92         return UIManager.getColor("TabbedPane.nonSelectedTabTitleNormalColor");
  93     }
  94 


< prev index next >