looks-2.2.0

on;
  }
  
  static Icon getComboBoxButtonIcon()
  {
    if (comboBoxButtonIcon == null) {
      comboBoxButtonIcon = new ComboBoxButtonIcon(null);
    }
    return comboBoxButtonIcon;
  }
}

/* Location:
 * Qualified Name:     com.jgoodies.looks.plastic.PlasticIconFactory
 * Java Class Version: 1.4 (48.0)
 * JD-Core Version:    0.7.1
 */
package com.jgoodies.looks.plastic;

import java.awt.Color;
import java.awt.Font;
import java.awt.FontMetrics;
import java.awt.Graphics;
import java.awt.Insets;
import java.awt.Rectangle;
import javax.swing.Icon;
import javax.swing.JButton;
import javax.swing.JInternalFrame;
import javax.swing.SwingUtilities;
import javax.swing.plaf.metal.MetalInternalFrameTitlePane;

public final class PlasticInternalFrameTitlePane
  extends MetalInternalFrameTitlePane
{
  private PlasticBumps paletteBumps;
  private final PlasticBumps activeBumps = new PlasticBumps(0, 0, PlasticLookAndFeel.getPrimaryControlHighlight(), PlasticLookAndFeel.getPrimaryControlDarkShadow(), PlasticLookAndFeel.getPrimaryControl());
  private final PlasticBumps inactiveBumps = new PlasticBumps(0, 0, PlasticLookAndFeel.getControlHighlight(), PlasticLookAndFeel.getControlDarkShadow(), PlasticLookAndFeel.getControl());
  
  public PlasticInternalFrameTitlePane(JInternalFrame frame)
  {
    super(frame);
  }
  
  public void paintPalette(Graphics g)
  {
    boolean leftToRight = PlasticUtils.isLeftToRight(frame);
    
    int width = getWidth();
    int height = getHeight();
    if (paletteBumps == null) {
      paletteBumps = new PlasticBumps(0, 0, PlasticLookAndFeel.getPrimaryControlHighlight(), PlasticLookAndFeel.getPrimaryControlInfo(), PlasticLookAndFeel.getPrimaryControlShadow());
    }
    Color background = PlasticLookAndFeel.getPrimaryControlShadow();
    Color darkShadow = PlasticLookAndFeel.getControlDarkShadow();
    
    g.setColor(background);
    g.fillRect(0, 0, width, height);
    
    g.setColor(darkShadow);
    g.drawLine(0, height - 1, width, height - 1);
    
    int buttonsWidth = getButtonsWidth();
    int xOffset = leftToRight ? 4 : buttonsWidth + 4;
    int bumpLength = width - buttonsWidth - 8;
    int bumpHeight = getHeight() - 4;
    paletteBumps.setBumpArea(bumpLength, bumpHeight);
    paletteBumps.paintIcon(this, g, xOffset, 2);
  }
  
  public void paintComponent(Graphics g)
  {
    if (isPalette)
    {
      paintPalette(g);
      return;
    }
    boolean leftToRight = PlasticUtils.isLeftToRight(frame);
    boolean isSelected = frame.isSelected();
    
    int width = getWidth();
    int height = getHeight();
    
    Color background = null;
    Color foreground = null;
    Color shadow = null;
    PlasticBumps bumps;
    PlasticBumps bumps;
    if (isSelected)
    {
      background = PlasticLookAndFeel.getWindowTitleBackground();
      foreground = PlasticLookAndFeel.getWindowTitleForeground();
      bumps = activeBumps;
    }
    else
    {
      background = PlasticLookAndFeel.getWindowTitleInactiveBackground();
      foreground = PlasticLookAndFeel.getWindowTitleInactiveForeground();
      bumps = inactiveBumps;
    }
    shadow = PlasticLookAndFeel.getControlDarkShadow();
    
    g.setColor(background);
    g.fillRect(0, 0, width, height);
    
    g.setColor(shadow);
    g.drawLine(0, height - 1, width, height - 1);
    g.drawLine(0, 0, 0, 0);
    g.drawLine(width - 1, 0, width - 1, 0);
    
    int titleLength = 0;
    int xOffset = leftToRight ? 5 : width - 5;
    String frameTitle = frame.getTitle();
    
    Icon icon = frame.getFrameIcon();
    if (icon != null)
    {
      if (!leftToRight) {
        xOffset -= icon.getIconWidth();
      }
      int iconY = height / 2 - icon.getIconHeight() / 2;
      icon.paintIcon(frame, g, xOffset, iconY);
      xOffset += (leftToRight ? icon.getIconWidth() + 5 : -5);
    }
    if (frameTitle != null)
    {
      Font f = getFont();
      g.setFont(f);
      FontMetrics fm = g.getFontMetrics();
      
      g.setColor(foreground);
      
      int yOffset = (height - fm.getHeight()) / 2 + fm.getAscent();
      
      Rectangle rect = new Rectangle(0, 0, 0, 0);
      if (frame.isIconifiable()) {
        rect = iconButton.getBounds();
      } else if (frame.isMaximizable()) {
        rect = maxButton.getBounds();
      } else if (frame.isClosable()) {
        rect = closeButton.getBounds();
      }
      if (leftToRight)
      {
        if (x == 0) {
          x = (frame.getWidth() - frame.getInsets().right - 2);
        }
        int titleW = x - xOffset - 4;
        frameTitle = getTitle(frameTitle, fm, titleW);
      }
      else
      {
        int titleW = xOffset - x - width - 4;
        frameTitle = getTitle(frameTitle, fm, titleW);
        xOffset -= SwingUtilities.computeStringWidth(fm, frameTitle);
      }
      titleLength = SwingUtilities.computeStringWidth(fm, frameTitle);
      g.drawString(frameTitle, xOffset, yOffset);
      xOffset += (leftToRight ? titleLength + 5 : -5);
    }
    int buttonsWidth = getButtonsWidth();
    int bumpXOffset;
    int bumpLength;
    int bumpXOffset;
    if (leftToRight)
    {
      int bumpLength = width - buttonsWidth - xOffset - 5;
      bumpXOffset = xOffset;
    }
    else
    {
      bumpLength = xOffset - buttonsWidth - 5;
      bumpXOffset = buttonsWidth + 5;
    }
    int bumpYOffset = 3;
    int bumpHeight = getHeight() - 2 * bumpYOffset;
    bumps.setBumpArea(bumpLength, bumpHeight);
    bumps.paintIcon(this, g, bumpXOffset, bumpYOffset);
  }
  
  protected String getTitle(String text, FontMetrics fm, int availTextWidth)
  {
    if ((text == null) || (text.equals(""))) {
      return "";
    }
    int textWidth = SwingUtilities.computeStringWidth(fm, text);
    String clipString = "�";
    if (textWidth > availTextWidth)
    {
      int totalWidth = SwingUtilities.computeStringWidth(fm, clipString);
      for (int nChars = 0; nChars < text.length(); nChars++)
      {
        totalWidth += fm.charWidth(text.charAt(nChars));
        if (totalWidth > availTextWidth) {
          break;
        }
      }
      text = text.substring(0, nChars) + clipString;
    }
    return text;
  }
  
  private int getButtonsWidth()
  {
    boolean leftToRight = PlasticUtils.isLeftToRight(frame);
    
    int w = getWidth();
    int x = leftToRight ? w : 0;
    
    int buttonWidth = closeButton.getIcon().getIconWidth();
    if (frame.isClosable()) {
      if (isPalette)
      {
        int spacing = 3;
        x += (leftToRight ? -spacing - (buttonWidth + 2) : spacing);
        if (!leftToRight) {
          x += buttonWidth + 2;
        }
      }
      else
      {
        int spacing = 4;
        x += (leftToRight ? -spacing - buttonWidth : spacing);
        if (!leftToRight) {
          x += buttonWidth;
        }
      }
    }
    if ((frame.isMaximizable()) && (!isPalette))
    {
      int spacing = frame.isClosable() ? 10 : 4;
      x += (leftToRight ? -spacing - buttonWidth : spacing);
      if (!leftToRight) {
        x += buttonWidth;
      }
    }
    if ((frame.isIconifiable()) && (!isPalette))
    {
      int spacing = frame.isClosable() ? 10 : frame.isMaximizable() ? 2 : 4;
      
      x += (leftToRight ? -spacing - buttonWidth : spacing);
      if (!leftToRight) {
        x += buttonWidth;
      }
    }
    return leftToRight ? w - x : x;
  }
}

/* Location:
 * Qualified Name:     com.jgoodies.looks.plastic.PlasticInternalFrameTitlePane
 * Java Class Version: 1.4 (48.0)
 * JD-Core Version:    0.7.1
 */
package com.jgoodies.looks.plastic;

class PlasticInternalFrameUI$1 {}

/* Location:
 * Qualified Name:     com.jgoodies.looks.plastic.PlasticInternalFrameUI.1
 * Java Class Version: 1.4 (48.0)
 * JD-Core Version:    0.7.1
 */
package com.jgoodies.looks.plastic;

import java.beans.PropertyChangeEvent;
import java.beans.PropertyChangeListener;

final class PlasticInternalFrameUI$ContentPaneListener
  implements PropertyChangeListener
{
  private final PlasticInternalFrameUI ui;
  
  PlasticInternalFrameUI$ContentPaneListener(PlasticInternalFrameUI x0, PlasticInternalFrameUI.1 x1)
  {
    this(x0);
  }
  
  private PlasticInternalFrameUI$ContentPaneListener(PlasticInternalFrameUI ui)
  {
    this.ui = ui;
  }
  
  public void propertyChange(PropertyChangeEvent e)
  {
    String name = e.getPropertyName();
    if (name.equals("contentPane")) {
      PlasticInternalFrameUI.access$300(ui, e.getNewValue());
    }
  }
}

/* Location:
 * Qualified Name:     com.jgoodies.looks.plastic.PlasticInternalFrameUI.ContentPaneListener
 * Java Class Version: 1.4 (48.0)
 * JD-Core Version:    0.7.1
 */
package com.jgoodies.looks.plastic;

import java.beans.PropertyChangeEvent;
import java.beans.PropertyChangeListener;

final class PlasticInternalFrameUI$PaletteListener
  implements PropertyChangeListener
{
  private final PlasticInternalFrameUI ui;
  
  PlasticInternalFrameUI$PaletteListener(PlasticInternalFrameUI x0, PlasticInternalFrameUI.1 x1)
  {
    this(x0);
  }
  
  private PlasticInternalFrameUI$PaletteListener(PlasticInternalFrameUI ui)
  {
    this.ui = ui;
  }
  
  public void propertyChange(PropertyChangeEvent e)
  {
    String name = e.getPropertyName();
    Object value = e.getNewValue();
    if (name.equals("JInternalFrame.frameType"))
    {
      if ((value instanceof String)) {
        PlasticInternalFrameUI.access$200(ui, (String)value);
      }
    }
    else if (name.equals("JInternalFrame.isPalette")) {
      ui.setPalette(Boolean.TRUE.equals(value));
    }
  }
}

/* Location:
 * Qualified Name:     com.jgoodies.looks.plastic.PlasticInternalFrameUI.PaletteListener
 * Java Class Version: 1.4 (48.0)
 * JD-Core Version:    0.7.1
 */
package com.jgoodies.looks.plastic;

import java.awt.Color;
import java.awt.Container;
import java.beans.PropertyChangeEvent;
import java.beans.PropertyChangeListener;
import javax.swing.JComponent;
import javax.swing.JInternalFrame;
import javax.swing.LookAndFeel;
import javax.swing.UIDefaults;
import javax.swing.UIManager;
import javax.swing.border.Border;
import javax.swing.border.EmptyBorder;
import javax.swing.plaf.ComponentUI;
import javax.swing.plaf.UIResource;
import javax.swing.plaf.basic.BasicInternalFrameUI;

public class PlasticInternalFrameUI
  extends BasicInternalFrameUI
{
  private static final String FRAME_TYPE = "JInternalFrame.frameType";
  public static final String IS_PALETTE = "JInternalFrame.isPalette";
  private static final String PALETTE_FRAME = "palette";
  private static final String OPTION_DIALOG = "optionDialog";
  private static final Border EMPTY_BORDER = new EmptyBorder(0, 0, 0, 0);
  private PlasticInternalFrameTitlePane titlePane;
  private PropertyChangeListener paletteListener;
  private PropertyChangeListener contentPaneListener;
  
  public PlasticInternalFrameUI(JInternalFrame b)
  {
    super(b);
  }
  
  public static ComponentUI createUI(JComponent c)
  {
    return new PlasticInternalFrameUI((JInternalFrame)c);
  }
  
  public void installUI(JComponent c)
  {
    frame = ((JInternalFrame)c);
    
    paletteListener = new PaletteListener(this, null);
    contentPaneListener = new ContentPaneListener(this, null);
    c.addPropertyChangeListener(paletteListener);
    c.addPropertyChangeListener(contentPaneListener);
    
    super.installUI(c);
    
    Object paletteProp = c.getClientProperty("JInternalFrame.isPalette");
    if (paletteProp != null) {
      setPalette(((Boolean)paletteProp).booleanValue());
    }
    Container content = frame.getContentPane();
    stripContentBorder(content);
  }
  
  public void uninstallUI(JComponent c)
  {
    frame = ((JInternalFrame)c);
    
    c.removePropertyChangeListener(paletteListener);
    c.removePropertyChangeListener(contentPaneListener);
    
    Container cont = ((JInternalFrame)c).getContentPane();
    if ((cont instanceof JComponent))
    {
      JComponent content = (JComponent)cont;
      if (content.getBorder() == EMPTY_BORDER) {
        content.setBorder(null);
      }
    }
    super.uninstallUI(c);
  }
  
  protected void installDefaults()
  {
    super.installDefaults();
    
    JComponent contentPane = (JComponent)frame.getContentPane();
    if (contentPane != null)
    {
      Color bg = contentPane.getBackground();
      if ((bg instanceof UIResource)) {
        contentPane.setBackground(null);
      }
    }
    frame.setBackground(UIManager.getLookAndFeelDefaults().getColor("control"));
  }
  
  protected void installKeyboardActions() {}
  
  protected void uninstallKeyboardActions() {}
  
  private void stripContentBorder(Object c)
  {
    if ((c instanceof JComponent))
    {
      JComponent contentComp = (JComponent)c;
      Border contentBorder = contentComp.getBorder();
      if ((contentBorder == null) || ((contentBorder instanceof UIResource))) {
        contentComp.setBorder(EMPTY_BORDER);
      }
    }
  }
  
  protected JComponent createNorthPane(JInternalFrame w)
  {
    titlePane = new PlasticInternalFrameTitlePane(w);
    return titlePane;
  }
  
  public void setPalette(boolean isPalette)
  {
    String key = isPalette ? "InternalFrame.paletteBorder" : "InternalFrame.border";
    LookAndFeel.installBorder(frame, key);
    titlePane.setPalette(isPalette);
  }
  
  private void setFrameType(String frameType)
  {
    boolean hasPalette = frameType.equals("palette");
    String key;
    String key;
    if (frameType.equals("optionDialog"))
    {
      key = "InternalFrame.optionDialogBorder";
    }
    else
    {
      String key;
      if (hasPalette) {
        key = "InternalFrame.paletteBorder";
      } else {
        key = "InternalFrame.border";
      }
    }
    LookAndFeel.installBorder(frame, key);
    titlePane.setPalette(hasPalette);
  }
  
  private static final class PaletteListener
    implements PropertyChangeListener
  {
    private final PlasticInternalFrameUI ui;
    
    PaletteListener(PlasticInternalFrameUI x0, PlasticInternalFrameUI.1 x1)
    {
      this(x0);
    }
    
    private PaletteListener(PlasticInternalFrameUI ui)
    {
      this.ui = ui;
    }
    
    public void propertyChange(PropertyChangeEvent e)
    {
      String name = e.getPropertyName();
      Object value = e.getNewValue();
      if (name.equals("JInternalFrame.frameType"))
      {
        if ((value instanceof String)) {
          ui.setFrameType((String)value);
        }
      }
      else if (name.equals("JInternalFrame.isPalette")) {
        ui.setPalette(Boolean.TRUE.equals(value));
      }
    }
  }
  
  private static final class ContentPaneListener
    implements PropertyChangeListener
  {
    private final PlasticInternalFrameUI ui;
    
    ContentPaneListener(PlasticInternalFrameUI x0, PlasticInternalFrameUI.1 x1)
    {
      this(x0);
    }
    
    private ContentPaneListener(PlasticInternalFrameUI ui)
    {
      this.ui = ui;
    }
    
    public void propertyChange(PropertyChangeEvent e)
    {
      String name = e.getPropertyName();
      if (name.equals("contentPane")) {
        ui.stripContentBorder(e.getNewValue());
      }
    }
  }
}

/* Location:
 * Qualified Name:     com.jgoodies.looks.plastic.PlasticInternalFrameUI
 * Java Class Version: 1.4 (48.0)
 * JD-Core Version:    0.7.1
 */
package com.jgoodies.looks.plastic;

import java.util.Comparator;
import javax.swing.plaf.metal.MetalTheme;

final class PlasticLookAndFeel$1
  implements Comparator
{
  public int compare(Object o1, Object o2)
  {
    MetalTheme theme1 = (MetalTheme)o1;
    MetalTheme theme2 = (MetalTheme)o2;
    return theme1.getName().compareTo(theme2.getName());
  }
}

/* Location:
 * Qualified Name:     com.jgoodies.looks.plastic.PlasticLookAndFeel.1
 * Java Class Version: 1.4 (48.0)
 * JD-Core Version:    0.7.1
 */
package com.jgoodies.looks.plastic;

import com.jgoodies.looks.FontPolicies;
import com.jgoodies.looks.FontPolicy;
import com.jgoodies.looks.LookUtils;
import com.jgoodies.looks.MicroLayout;
import com.jgoodies.looks.MicroLayoutPolicies;
import com.jgoodies.looks.MicroLayoutPolicy;
import com.jgoodies.looks.common.MinimumSizedIcon;
import com.jgoodies.looks.common.RGBGrayFilter;
import com.jgoodies.looks.common.ShadowPopupFactory;
import com.jgoodies.looks.plastic.theme.SkyBluer;
import java.awt.Color;
import java.awt.Font;
import java.awt.Insets;
import java.awt.Toolkit;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Comparator;
import java.util.List;
import javax.swing.Icon;
import javax.swing.JComponent;
import javax.swing.UIDefaults;
import javax.swing.UIManager;
import javax.swing.border.Border;
import javax.swing.border.EmptyBorder;
import javax.swing.plaf.BorderUIResource;
import javax.swing.plaf.ColorUIResource;
import javax.swing.plaf.FontUIResource;
import javax.swing.plaf.IconUIResource;
import javax.swing.plaf.InsetsUIResource;
import javax.swing.plaf.basic.BasicBorders.MarginBorder;
import javax.swing.plaf.metal.MetalLookAndFeel;
import javax.swing.plaf.metal.MetalTheme;

public class PlasticLookAndFeel
  extends MetalLookAndFeel
{
  public static final String BORDER_STYLE_KEY = "Plastic.borderStyle";
  public static final String IS_3D_KEY = "Plastic.is3D";
  public static final String DEFAULT_THEME_KEY = "Plastic.defaultTheme";
  public static final String HIGH_CONTRAST_FOCUS_ENABLED_KEY = "Plastic.highContrastFocus";
  protected static final String TAB_STYLE_KEY = "Plastic.tabStyle";
  public static final String TAB_STYLE_DEFAULT_VALUE = "default";
  public static final String TAB_STYLE_METAL_VALUE = "metal";
  private static final Object THEME_KEY = new StringBuffer("Plastic.theme");
  private static boolean useMetalTabs = LookUtils.getSystemProperty("Plastic.tabStyle", "").equalsIgnoreCase("metal");
  private static boolean useHighContrastFocusColors = LookUtils.getSystemProperty("Plastic.highContrastFocus") != null;
  private static List installedThemes;
  private static boolean is3DEnabled = false;
  private static boolean selectTextOnKeyboardFocusGained = LookUtils.IS_OS_WINDOWS;
  private static Method getCurrentThemeMethod = null;
  private static final String THEME_CLASSNAME_PREFIX = "com.jgoodies.looks.plastic.theme.";
  
  static
  {
    if (LookUtils.IS_JAVA_5_OR_LATER) {
      getCurrentThemeMethod = getMethodGetCurrentTheme();
    }
  }
  
  public PlasticLookAndFeel()
  {
    getPlasticTheme();
  }
  
  public String getID()
  {
    return "JGoodies Plastic";
  }
  
  public String getName()
  {
    return "JGoodies Plastic";
  }
  
  public String getDescription()
  {
    return "The JGoodies Plastic Look and Feel - � 2001-2008 JGoodies Karsten Lentzsch";
  }
  
  public static FontPolicy getFontPolicy()
  {
    FontPolicy policy = (FontPolicy)UIManager.get("Plastic.fontPolicy");
    if (policy != null) {
      return policy;
    }
    FontPolicy defaultPolicy = FontPolicies.getDefaultPlasticPolicy();
    return FontPolicies.customSettingsPolicy(defaultPolicy);
  }
  
  public static void setFontPolicy(FontPolicy fontPolicy)
  {
    UIManager.put("Plastic.fontPolicy", fontPolicy);
  }
  
  public static MicroLayoutPolicy getMicroLayoutPolicy()
  {
    MicroLayoutPolicy policy = (MicroLayoutPolicy)UIManager.get("Plastic.MicroLayoutPolicy");
    
    return policy != null ? policy : MicroLayoutPolicies.getDefaultPlasticPolicy();
  }
  
  public static void setMicroLayoutPolicy(MicroLayout microLayoutPolicy)
  {
    UIManager.put("Plastic.MicroLayoutPolicy", microLayoutPolicy);
  }
  
  protected boolean is3DEnabled()
  {
    return is3DEnabled;
  }
  
  public static void set3DEnabled(boolean b)
  {
    is3DEnabled = b;
  }
  
  public static String getTabStyle()
  {
    return useMetalTabs ? "metal" : "default";
  }
  
  public static void setTabStyle(String tabStyle)
  {
    useMetalTabs = tabStyle.equalsIgnoreCase("metal");
  }
  
  public static boolean getHighContrastFocusColorsEnabled()
  {
    return useHighContrastFocusColors;
  }
  
  public static void setHighContrastFocusColorsEnabled(boolean b)
  {
    useHighContrastFocusColors = b;
  }
  
  public static boolean isSelectTextOnKeyboardFocusGained()
  {
    return selectTextOnKeyboardFocusGained;
  }
  
  public static void setSelectTextOnKeyboardFocusGained(boolean b)
  {
    selectTextOnKeyboardFocusGained = b;
  }
  
  public void initialize()
  {
    super.initialize();
    ShadowPopupFactory.install();
  }
  
  public void uninitialize()
  {
    super.uninitialize();
    ShadowPopupFactory.uninstall();
  }
  
  public Icon getDisabledIcon(JComponent component, Icon icon)
  {
    Icon disabledIcon = RGBGrayFilter.getDisabledIcon(component, icon);
    return disabledIcon != null ? new IconUIResource(disabledIcon) : null;
  }
  
  protected void initClassDefaults(UIDefaults table)
  {
    super.initClassDefaults(table);
    
    String plasticPrefix = "com.jgoodies.looks.plastic.Plastic";
    String commonPrefix = "com.jgoodies.looks.common.ExtBasic";
    
    Object[] uiDefaults = { "ButtonUI", "com.jgoodies.looks.plastic.PlasticButtonUI", "ToggleButtonUI", "com.jgoodies.looks.plastic.PlasticToggleButtonUI", "ComboBoxUI", "com.jgoodies.looks.plastic.PlasticComboBoxUI", "ScrollBarUI", "com.jgoodies.looks.plastic.PlasticScrollBarUI", "SpinnerUI", "com.jgoodies.looks.plastic.PlasticSpinnerUI", "MenuBarUI", "com.jgoodies.looks.plastic.PlasticMenuBarUI", "ToolBarUI", "com.jgoodies.looks.plastic.PlasticToolBarUI", "MenuUI", "com.jgoodies.looks.plastic.PlasticMenuUI", "MenuItemUI", "com.jgoodies.looks.common.ExtBasicMenuItemUI", "CheckBoxMenuItemUI", "com.jgoodies.looks.common.ExtBasicCheckBoxMenuItemUI", "RadioButtonMenuItemUI", "com.jgoodies.looks.common.ExtBasicRadioButtonMenuItemUI", "PopupMenuUI", "com.jgoodies.looks.plastic.PlasticPopupMenuUI", "PopupMenuSeparatorUI", "com.jgoodies.looks.common.ExtBasicPopupMenuSeparatorUI", "OptionPaneUI", "com.jgoodies.looks.plastic.PlasticOptionPaneUI", "ScrollPaneUI", "com.jgoodies.looks.plastic.PlasticScrollPaneUI", "SplitPaneUI", "com.jgoodies.looks.plastic.PlasticSplitPaneUI", "PasswordFieldUI", "com.jgoodies.looks.plastic.PlasticPasswordFieldUI", "TextAreaUI", "com.jgoodies.looks.plastic.PlasticTextAreaUI", "TreeUI", "com.jgoodies.looks.plastic.PlasticTreeUI", "InternalFrameUI", "com.jgoodies.looks.plastic.PlasticInternalFrameUI", "SeparatorUI", "com.jgoodies.looks.plastic.PlasticSeparatorUI", "ToolBarSeparatorUI", "com.jgoodies.looks.plastic.PlasticToolBarSeparatorUI", "FileChooserUI", "com.jgoodies.looks.plastic.PlasticFileChooserUI" };
    if (!useMetalTabs) {
      uiDefaults = append(uiDefaults, "TabbedPaneUI", "com.jgoodies.looks.plastic.PlasticTabbedPaneUI");
    }
    if (isSelectTextOnKeyboardFocusGained())
    {
      uiDefaults = append(uiDefaults, "TextFieldUI", "com.jgoodies.looks.plastic.PlasticTextFieldUI");
      
      uiDefaults = append(uiDefaults, "FormattedTextFieldUI", "com.jgoodies.looks.plastic.PlasticFormattedTextFieldUI");
    }
    table.putDefaults(uiDefaults);
  }
  
  protected void initComponentDefaults(UIDefaults table)
  {
    super.initComponentDefaults(table);
    
    MicroLayout microLayout = getMicroLayoutPolicy().getMicroLayout(getName(), table);
    Insets buttonBorderInsets = microLayout.getButtonBorderInsets();
    
    Object marginBorder = new BasicBorders.MarginBorder();
    
    Object buttonBorder = PlasticBorders.getButtonBorder(buttonBorderInsets);
    Object comboBoxButtonBorder = PlasticBorders.getComboBoxArrowButtonBorder();
    Border comboBoxEditorBorder = PlasticBorders.getComboBoxEditorBorder();
    Object menuItemBorder = PlasticBorders.getMenuItemBorder();
    Object textFieldBorder = PlasticBorders.getTextFieldBorder();
    Object toggleButtonBorder = PlasticBorders.getToggleButtonBorder(buttonBorderInsets);
    
    Object scrollPaneBorder = PlasticBorders.getScrollPaneBorder();
    Object tableHeaderBorder = new BorderUIResource((Border)table.get("TableHeader.cellBorder"));
    
    Object menuBarEmptyBorder = marginBorder;
    Object menuBarSeparatorBorder = PlasticBorders.getSeparatorBorder();
    Object menuBarEtchedBorder = PlasticBorders.getEtchedBorder();
    Object menuBarHeaderBorder = PlasticBorders.getMenuBarHeaderBorder();
    
    Object toolBarEmptyBorder = marginBorder;
    Object toolBarSeparatorBorder = PlasticBorders.getSeparatorBorder();
    Object toolBarEtchedBorder = PlasticBorders.getEtchedBorder();
    Object toolBarHeaderBorder = PlasticBorders.getToolBarHeaderBorder();
    
    Object internalFrameBorder = getInternalFrameBorder();
    Object paletteBorder = getPaletteBorder();
    
    Color controlColor = table.getColor("control");
    
    Object checkBoxIcon = PlasticIconFactory.getCheckBoxIcon();
    Object checkBoxMargin = microLayout.getCheckBoxMargin();
    
    Object buttonMargin = microLayout.getButtonMargin();
    Object textInsets = microLayout.getTextInsets();
    Object wrappedTextInsets = microLayout.getWrappedTextInsets();
    Insets comboEditorInsets = microLayout.getComboBoxEditorInsets();
    
    Insets comboEditorBorderInsets = comboBoxEditorBorder.getBorderInsets(null);
    int comboBorderSize = left;
    int comboPopupBorderSize = microLayout.getComboPopupBorderSize();
    int comboRendererGap = left + comboBorderSize - comboPopupBorderSize;
    Object comboRendererBorder = new EmptyBorder(1, comboRendererGap, 1, comboRendererGap);
    Object comboTableEditorInsets = new Insets(0, 0, 0, 0);
    
    Object menuItemMargin = microLayout.getMenuItemMargin();
    Object menuMargin = microLayout.getMenuMargin();
    
    Icon menuItemCheckIcon = new MinimumSizedIcon();
    Icon checkBoxMenuItemIcon = PlasticIconFactory.getCheckBoxMenuItemIcon();
    Icon radioButtonMenuItemIcon = PlasticIconFactory.getRadioButtonMenuItemIcon();
    
    Color menuItemForeground = table.getColor("MenuItem.foreground");
    
    Color inactiveTextBackground = table.getColor("TextField.inactiveBackground");
    
    int treeFontSize = table.getFont("Tree.font").getSize();
    Integer rowHeight = new Integer(treeFontSize + 6);
    Object treeExpandedIcon = PlasticIconFactory.getExpandedTreeIcon();
    Object treeCollapsedIcon = PlasticIconFactory.getCollapsedTreeIcon();
    ColorUIResource gray = new ColorUIResource(Color.GRAY);
    
    Boolean is3D = Boolean.valueOf(is3DEnabled());
    
    Character passwordEchoChar = new Character(LookUtils.IS_OS_WINDOWS ? '?' : '�');
    
    String iconPrefix = "icons/" + (LookUtils.IS_LOW_RESOLUTION ? "32x32/" : "48x48/");
    Object errorIcon = makeIcon(getClass(), iconPrefix + "dialog-error.png");
    Object informationIcon = makeIcon(getClass(), iconPrefix + "dialog-information.png");
    Object questionIcon = makeIcon(getClass(), iconPrefix + "dialog-question.png");
    Object warningIcon = makeIcon(getClass(), iconPrefix + "dialog-warning.png");
    
    Object[] defaults = { "Button.border", buttonBorder, "Button.margin", buttonMargin, "CheckBox.margin", checkBoxMargin, "CheckBox.icon", checkBoxIcon, "CheckBoxMenuItem.border", menuItemBorder, "CheckBoxMenuItem.margin", menuItemMargin, "CheckBoxMenuItem.checkIcon", checkBoxMenuItemIcon, "CheckBoxMenuItem.background", getMenuItemBackground(), "CheckBoxMenuItem.selectionForeground", getMenuItemSelectedForeground(), "CheckBoxMenuItem.selectionBackground", getMenuItemSelectedBackground(), "CheckBoxMenuItem.acceleratorForeground", menuItemForeground, "CheckBoxMenuItem.acceleratorSelectionForeground", getMenuItemSelectedForeground(), "CheckBoxMenuItem.acceleratorSelectionBackground", getMenuItemSelectedBackground(), "ComboBox.selectionForeground", getMenuSelectedForeground(), "ComboBox.selectionBackground", getMenuSelectedBackground(), "ComboBox.arrowButtonBorder", comboBoxButtonBorder, "ComboBox.editorBorder", comboBoxEditorBorder, "ComboBox.editorColumns", new Integer(5), "ComboBox.editorBorderInsets", comboEditorBorderInsets, "ComboBox.editorInsets", textInsets, "ComboBox.tableEditorInsets", comboTableEditorInsets, "ComboBox.rendererBorder", comboRendererBorder, "EditorPane.margin", wrappedTextInsets, "InternalFrame.border", internalFrameBorder, "InternalFrame.paletteBorder", paletteBorder, "List.font", getControlTextFont(), "Menu.border", PlasticBorders.getMenuBorder(), "Menu.margin", menuMargin, "Menu.arrowIcon", PlasticIconFactory.getMenuArrowIcon(), "MenuBar.emptyBorder", menuBarEmptyBorder, "MenuBar.separatorBorder", menuBarSeparatorBorder, "MenuBar.etchedBorder", menuBarEtchedBorder, "MenuBar.headerBorder", menuBarHeaderBorder, "MenuItem.border", menuItemBorder, "MenuItem.checkIcon", menuItemCheckIcon, "MenuItem.margin", menuItemMargin, "MenuItem.background", getMenuItemBackground(), "MenuItem.selectionForeground", getMenuItemSelectedForeground(), "MenuItem.selectionBackground", getMenuItemSelectedBackground(), "MenuItem.acceleratorForeground", menuItemForeground, "MenuItem.acceleratorSelectionForeground", getMenuItemSelectedForeground(), "MenuItem.acceleratorSelectionBackground", getMenuItemSelectedBackground(), "OptionPane.errorIcon", errorIcon, "OptionPane.informationIcon", informationIcon, "OptionPane.questionIcon", questionIcon, "OptionPane.warningIcon", warningIcon, "FileView.computerIcon", makeIcon(getClass(), "icons/Computer.gif"), "FileView.directoryIcon", makeIcon(getClass(), "icons/TreeClosed.gif"), "FileView.fileIcon", makeIcon(getClass(), "icons/File.gif"), "FileView.floppyDriveIcon", makeIcon(getClass(), "icons/FloppyDrive.gif"), "FileView.hardDriveIcon", makeIcon(getClass(), "icons/HardDrive.gif"), "FileChooser.homeFolderIcon", makeIcon(getClass(), "icons/HomeFolder.gif"), "FileChooser.newFolderIcon", makeIcon(getClass(), "icons/NewFolder.gif"), "FileChooser.upFolderIcon", makeIcon(getClass(), "icons/UpFolder.gif"), "Tree.closedIcon", makeIcon(getClass(), "icons/TreeClosed.gif"), "Tree.openIcon", makeIcon(getClass(), "icons/TreeOpen.gif"), "Tree.leafIcon", makeIcon(getClass(), "icons/TreeLeaf.gif"), "FormattedTextField.border", textFieldBorder, "FormattedTextField.margin", textInsets, "PasswordField.border", textFieldBorder, "PasswordField.margin", textInsets, "PasswordField.echoChar", passwordEchoChar, "PopupMenu.border", PlasticBorders.getPopupMenuBorder(), "PopupMenu.noMarginBorder", PlasticBorders.getNoMarginPopupMenuBorder(), "PopupMenuSeparator.margin", new InsetsUIResource(3, 4, 3, 4), "RadioButton.margin", checkBoxMargin, "RadioButtonMenuItem.border", menuItemBorder, "RadioButtonMenuItem.checkIcon", radioButtonMenuItemIcon, "RadioButtonMenuItem.margin", menuItemMargin, "RadioButtonMenuItem.background", getMenuItemBackground(), "RadioButtonMenuItem.selectionForeground", getMenuItemSelectedForeground(), "RadioButtonMenuItem.selectionBackground", getMenuItemSelectedBackground(), "RadioButtonMenuItem.acceleratorForeground", menuItemForeground, "RadioButtonMenuItem.acceleratorSelectionForeground", getMenuItemSelectedForeground(), "RadioButtonMenuItem.acceleratorSelectionBackground", getMenuItemSelectedBackground(), "Separator.foreground", getControlDarkShadow(), "ScrollPane.border", scrollPaneBorder, "ScrollPane.etchedBorder", scrollPaneBorder, "SimpleInternalFrame.activeTitleForeground", getSimpleInternalFrameForeground(), "SimpleInternalFrame.activeTitleBackground", getSimpleInternalFrameBackground(), "Spinner.border", PlasticBorders.getFlush3DBorder(), "Spinner.defaultEditorInsets", textInsets, "SplitPane.dividerSize", new Integer(7), "TabbedPane.focus", getFocusColor(), "TabbedPane.tabInsets", new InsetsUIResource(1, 9, 1, 8), "Table.foreground", table.get("textText"), "Table.gridColor", controlColor, "Table.scrollPaneBorder", scrollPaneBorder, "TableHeader.cellBorder", tableHeaderBorder, "TextArea.inactiveBackground", inactiveTextBackground, "TextArea.margin", wrappedTextInsets, "TextField.border", textFieldBorder, "TextField.margin", textInsets, "TitledBorder.font", getTitleTextFont(), "TitledBorder.titleColor", getTitleTextColor(), "ToggleButton.border", toggleButtonBorder, "ToggleButton.margin", buttonMargin, "ToolBar.emptyBorder", toolBarEmptyBorder, "ToolBar.separatorBorder", toolBarSeparatorBorder, "ToolBar.etchedBorder", toolBarEtchedBorder, "ToolBar.headerBorder", toolBarHeaderBorder, "ToolTip.hideAccelerator", Boolean.TRUE, "Tree.expandedIcon", treeExpandedIcon, "Tree.collapsedIcon", treeCollapsedIcon, "Tree.line", gray, "Tree.hash", gray, "Tree.rowHeight", rowHeight, "Button.is3DEnabled", is3D, "ComboBox.is3DEnabled", is3D, "MenuBar.is3DEnabled", is3D, "ToolBar.is3DEnabled", is3D, "ScrollBar.is3DEnabled", is3D, "ToggleButton.is3DEnabled", is3D, "CheckBox.border", marginBorder, "RadioButton.border", marginBorder, "ProgressBar.selectionForeground", getSystemTextColor(), "ProgressBar.selectionBackground", getSystemTextColor() };
    
    table.putDefaults(defaults);
    
    String soundPathPrefix = "/javax/swing/plaf/metal/";
    Object[] auditoryCues = (Object[])table.get("AuditoryCues.allAuditoryCues");
    if (auditoryCues != null)
    {
      Object[] audioDefaults = new String[auditoryCues.length * 2];
      for (int i = 0; i < auditoryCues.length; i++)
      {
        Object auditoryCue = auditoryCues[i];
        audioDefaults[(2 * i)] = auditoryCue;
        audioDefaults[(2 * i + 1)] = (soundPathPrefix + table.getString(auditoryCue));
      }
      table.putDefaults(audioDefaults);
    }
  }
  
  protected void initSystemColorDefaults(UIDefaults table)
  {
    super.initSystemColorDefaults(table);
    table.put("unifiedControlShadow", table.getColor("controlDkShadow"));
    table.put("primaryControlHighlight", getPrimaryControlHighlight());
  }
  
  public static PlasticTheme createMyDefaultTheme()
  {
    String defaultName;
    String defaultName;
    if (LookUtils.IS_LAF_WINDOWS_XP_ENABLED)
    {
      defaultName = getDefaultXPTheme();
    }
    else
    {
      String defaultName;
      if (LookUtils.IS_OS_WINDOWS_MODERN) {
        defaultName = "DesertBluer";
      } else {
        defaultName = "SkyBlue";
      }
    }
    String userName = LookUtils.getSystemProperty("Plastic.defaultTheme", "");
    boolean overridden = userName.length() > 0;
    String themeName = overridden ? userName : defaultName;
    PlasticTheme theme = createTheme(themeName);
    PlasticTheme result = theme != null ? theme : new SkyBluer();
    if (overridden)
    {
      String className = result.getClass().getName().substring("com.jgoodies.looks.plastic.theme.".length());
      if (className.equals(userName))
      {
        LookUtils.log("I have successfully installed the '" + result.getName() + "' theme.");
      }
      else
      {
        LookUtils.log("I could not install the Plastic theme '" + userName + "'.");
        LookUtils.log("I have installed the '" + result.getName() + "' theme, instead.");
      }
    }
    return result;
  }
  
  private static String getDefaultXPTheme()
  {
    String fallbackName = "ExperienceBlue";
    Toolkit toolkit = Toolkit.getDefaultToolkit();
    String xpstyleDll = (String)toolkit.getDesktopProperty("win.xpstyle.dllName");
    if (xpstyleDll == null) {
      return fallbackName;
    }
    boolean isStyleLuna = xpstyleDll.endsWith("luna.msstyles");
    boolean isStyleRoyale = xpstyleDll.endsWith("Royale.msstyles");
    boolean isStyleAero = xpstyleDll.endsWith("Aero.msstyles");
    if (isStyleRoyale) {
      return "ExperienceRoyale";
    }
    if (isStyleLuna)
    {
      String xpstyleColorName = (String)toolkit.getDesktopProperty("win.xpstyle.colorName");
      if (xpstyleColorName == null) {
        return fallbackName;
      }
      if (xpstyleColorName.equalsIgnoreCase("HomeStead")) {
        return "ExperienceGreen";
      }
      if (xpstyleColorName.equalsIgnoreCase("Metallic")) {
        return "Silver";
      }
      return fallbackName;
    }
    if (isStyleAero) {
      return "LightGray";
    }
    return fallbackName;
  }
  
  public static List getInstalledThemes()
  {
    if (null == installedThemes) {
      installDefaultThemes();
    }
    Collections.sort(installedThemes, new Comparator()
    {
      public int compare(Object o1, Object o2)
      {
        MetalTheme theme1 = (MetalTheme)o1;
        MetalTheme theme2 = (MetalTheme)o2;
        return theme1.getName().compareTo(theme2.getName());
      }
    });
    return installedThemes;
  }
  
  protected static void installDefaultThemes()
  {
    installedThemes = new ArrayList();
    String[] themeNames = { "BrownSugar", "DarkStar", "DesertBlue", "DesertBluer", "DesertGreen", "DesertRed", "DesertYellow", "ExperienceBlue", "ExperienceGreen", "ExperienceRoyale", "LightGray", "Silver", "SkyBlue", "SkyBluer", "SkyGreen", "SkyKrupp", "SkyPink", "SkyRed", "SkyYellow" };
    for (int i = themeNames.length - 1; i >= 0; i--) {
      installTheme(createTheme(themeNames[i]));
    }
  }
  
  protected static PlasticTheme createTheme(String themeName)
  {
    String className = "com.jgoodies.looks.plastic.theme." + themeName;
    try
    {
      Class cl = Class.forName(className);
      return (PlasticTheme)cl.newInstance();
    }
    catch (ClassNotFoundException e) {}catch (IllegalAccessException e) {}catch (InstantiationException e) {}
    LookUtils.log("Can't create theme " + className);
    return null;
  }
  
  public static void installTheme(PlasticTheme theme)
  {
    if (null == installedThemes) {
      installDefaultThemes();
    }
    installedThemes.add(theme);
  }
  
  public static PlasticTheme getPlasticTheme()
  {
    if (LookUtils.IS_JAVA_5_OR_LATER)
    {
      MetalTheme theme = getCurrentTheme0();
      if ((theme instanceof PlasticTheme)) {
        return (PlasticTheme)theme;
      }
    }
    PlasticTheme uimanagerTheme = (PlasticTheme)UIManager.get(THEME_KEY);
    if (uimanagerTheme != null) {
      return uimanagerTheme;
    }
    PlasticTheme initialTheme = createMyDefaultTheme();
    setPlasticTheme(initialTheme);
    return initialTheme;
  }
  
  public static void setPlasticTheme(PlasticTheme theme)
  {
    if (theme == null) {
      throw new NullPointerException("The theme must not be null.");
    }
    UIManager.put(THEME_KEY, theme);
    
    setCurrentTheme(theme);
  }
  
  public static BorderUIResource getInternalFrameBorder()
  {
    return new BorderUIResource(PlasticBorders.getInternalFrameBorder());
  }
  
  public static BorderUIResource getPaletteBorder()
  {
    return new BorderUIResource(PlasticBorders.getPaletteBorder());
  }
  
  public static ColorUIResource getPrimaryControlDarkShadow()
  {
    return getPlasticTheme().getPrimaryControlDarkShadow();
  }
  
  public static ColorUIResource getPrimaryControlHighlight()
  {
    return getPlasticTheme().getPrimaryControlHighlight();
  }
  
  public static ColorUIResource getPrimaryControlInfo()
  {
    return getPlasticTheme().getPrimaryControlInfo();
  }
  
  public static ColorUIResource getPrimaryControlShadow()
  {
    return getPlasticTheme().getPrimaryControlShadow();
  }
  
  public static ColorUIResource getPrimaryControl()
  {
    return getPlasticTheme().getPrimaryControl();
  }
  
  public static ColorUIResource getControlHighlight()
  {
    return getPlasticTheme().getControlHighlight();
  }
  
  public static ColorUIResource getControlDarkShadow()
  {
    return getPlasticTheme().getControlDarkShadow();
  }
  
  public static ColorUIResource getControl()
  {
    return getPlasticTheme().getControl();
  }
  
  public static ColorUIResource getFocusColor()
  {
    return getPlasticTheme().getFocusColor();
  }
  
  public static ColorUIResource getMenuItemBackground()
  {
    return getPlasticTheme().getMenuItemBackground();
  }
  
  public static ColorUIResource getMenuItemSelectedBackground()
  {
    return getPlasticTheme().getMenuItemSelectedBackground();
  }
  
  public static ColorUIResource getMenuItemSelectedForeground()
  {
    return getPlasticTheme().getMenuItemSelectedForeground();
  }
  
  public static ColorUIResource getWindowTitleBackground()
  {
    return getPlasticTheme().getWindowTitleBackground();
  }
  
  public static ColorUIResource getWindowTitleForeground()
  {
    return get
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19

Further reading...

For more information on Java 1.5 Tiger, you may find Java 1.5 Tiger, A developer's Notebook by D. Flanagan and B. McLaughlin from O'Reilly of interest.

New!JAR listings


Copyright 2006-2017. Infinite Loop Ltd