looks-2.2.0

 bottom = h - 1;
      int left = 0;
      g.translate(x, y);
      
      g.setColor(selectHighlight);
      
      g.fillRect(left + 2, 0, w - 2 - left, 1);
      
      g.fillRect(left + 1, 1, 1, 1);
      g.fillRect(left, 2, 1, bottom - 3);
      g.setColor(darkShadow);
      g.fillRect(left + 1, bottom - 1, 1, 1);
      
      g.fillRect(left + 2, bottom, w - 2 - left, 1);
      
      g.translate(-x, -y);
    }
    
    protected void paintContentBorderLeftEdge(Graphics g, int x, int y, int w, int h, boolean drawBroken, Rectangle selRect, boolean isContentBorderPainted)
    {
      g.setColor(selectHighlight);
      if ((drawBroken) && (y >= y) && (y <= y + h))
      {
        g.fillRect(x, y, 1, y + 1 - y);
        if (y + height < y + h - 2) {
          g.fillRect(x, y + height - 1, 1, y + h - y - height);
        }
      }
      else
      {
        g.fillRect(x, y, 1, h - 1);
      }
    }
  }
  
  private static final class RightEmbeddedRenderer
    extends PlasticTabbedPaneUI.AbstractRenderer
  {
    RightEmbeddedRenderer(JTabbedPane x0, PlasticTabbedPaneUI.1 x1)
    {
      this(x0);
    }
    
    private RightEmbeddedRenderer(JTabbedPane tabPane)
    {
      super(null);
    }
    
    protected Insets getTabAreaInsets(Insets insets)
    {
      return EMPTY_INSETS;
    }
    
    protected Insets getContentBorderInsets(Insets defaultInsets)
    {
      return EAST_INSETS;
    }
    
    protected int getTabRunIndent(int run)
    {
      return 4 * run;
    }
    
    protected int getTabRunOverlay(int tabRunOverlay)
    {
      return 0;
    }
    
    protected boolean shouldPadTabRun(int run, boolean aPriori)
    {
      return false;
    }
    
    protected Insets getTabInsets(int tabIndex, Insets tabInsets)
    {
      return new Insets(top, left, bottom, right);
    }
    
    protected Insets getSelectedTabPadInsets()
    {
      return EMPTY_INSETS;
    }
    
    protected void paintTabBackground(Graphics g, int tabIndex, int x, int y, int w, int h, boolean isSelected)
    {
      g.setColor(selectColor);
      g.fillRect(x, y, w, h);
    }
    
    protected void paintTabBorder(Graphics g, int tabIndex, int x, int y, int w, int h, boolean isSelected)
    {
      int bottom = h;
      int right = w - 1;
      
      g.translate(x + 1, y);
      if (isFirstDisplayedTab(tabIndex, y, tabPane.getBounds().y))
      {
        if (isSelected)
        {
          g.setColor(shadowColor);
          
          g.fillRect(right - 1, bottom - 1, 1, 1);
          g.fillRect(0, bottom, right - 1, 1);
          g.setColor(selectHighlight);
          g.fillRect(0, 0, right - 1, 1);
          g.fillRect(right - 1, 0, 1, bottom - 1);
          g.fillRect(0, bottom - 1, right - 1, 1);
        }
      }
      else if (isSelected)
      {
        g.setColor(shadowColor);
        g.fillRect(0, -1, right - 1, 1);
        g.fillRect(right - 1, 0, 1, 1);
        
        g.fillRect(right - 1, bottom - 1, 1, 1);
        g.fillRect(0, bottom, right - 1, 1);
        g.setColor(selectHighlight);
        g.fillRect(0, 0, right - 1, 1);
        g.fillRect(right - 1, 1, 1, bottom - 2);
        g.fillRect(0, bottom - 1, right - 1, 1);
      }
      else
      {
        g.setColor(shadowColor);
        g.fillRect(2 * right / 3, 0, right / 3, 1);
      }
      g.translate(-x - 1, -y);
    }
    
    protected void paintContentBorderRightEdge(Graphics g, int x, int y, int w, int h, boolean drawBroken, Rectangle selRect, boolean isContentBorderPainted)
    {
      g.setColor(shadowColor);
      g.fillRect(x + w - 1, y, 1, h);
    }
    
    protected void paintFocusIndicator(Graphics g, Rectangle[] rects, int tabIndex, Rectangle iconRect, Rectangle textRect, boolean isSelected) {}
  }
  
  private static final class RightRenderer
    extends PlasticTabbedPaneUI.AbstractRenderer
  {
    RightRenderer(JTabbedPane x0, PlasticTabbedPaneUI.1 x1)
    {
      this(x0);
    }
    
    private RightRenderer(JTabbedPane tabPane)
    {
      super(null);
    }
    
    protected int getTabLabelShiftX(int tabIndex, boolean isSelected)
    {
      return 1;
    }
    
    protected int getTabRunOverlay(int tabRunOverlay)
    {
      return 1;
    }
    
    protected boolean shouldPadTabRun(int run, boolean aPriori)
    {
      return false;
    }
    
    protected Insets getTabInsets(int tabIndex, Insets tabInsets)
    {
      return new Insets(top, left - 5, bottom + 1, right - 5);
    }
    
    protected Insets getSelectedTabPadInsets()
    {
      return EAST_INSETS;
    }
    
    protected void paintFocusIndicator(Graphics g, Rectangle[] rects, int tabIndex, Rectangle iconRect, Rectangle textRect, boolean isSelected)
    {
      if ((!tabPane.hasFocus()) || (!isSelected)) {
        return;
      }
      Rectangle tabRect = rects[tabIndex];
      int top = y + 2;
      int left = x + 3;
      int height = height - 5;
      int width = width - 6;
      g.setColor(focus);
      g.drawRect(left, top, width, height);
    }
    
    protected void paintTabBackground(Graphics g, int tabIndex, int x, int y, int w, int h, boolean isSelected)
    {
      if (!isSelected)
      {
        g.setColor(selectLight);
        g.fillRect(x, y, w, h);
      }
      else
      {
        g.setColor(selectColor);
        g.fillRect(x + 2, y, w - 2, h);
      }
    }
    
    protected void paintTabBorder(Graphics g, int tabIndex, int x, int y, int w, int h, boolean isSelected)
    {
      int bottom = h - 1;
      int right = w;
      
      g.translate(x, y);
      
      g.setColor(selectHighlight);
      g.fillRect(0, 0, right - 1, 1);
      
      g.setColor(darkShadow);
      g.fillRect(right - 1, 1, 1, 1);
      g.fillRect(right, 2, 1, bottom - 3);
      
      g.fillRect(right - 1, bottom - 1, 1, 1);
      g.fillRect(0, bottom, right - 1, 1);
      
      g.translate(-x, -y);
    }
    
    protected void paintContentBorderRightEdge(Graphics g, int x, int y, int w, int h, boolean drawBroken, Rectangle selRect, boolean isContentBorderPainted)
    {
      g.setColor(darkShadow);
      if ((drawBroken) && (y >= y) && (y <= y + h))
      {
        g.fillRect(x + w - 1, y, 1, y - y);
        if (y + height < y + h - 2) {
          g.fillRect(x + w - 1, y + height, 1, y + h - y - height);
        }
      }
      else
      {
        g.fillRect(x + w - 1, y, 1, h - 1);
      }
    }
  }
  
  private static final class TopEmbeddedRenderer
    extends PlasticTabbedPaneUI.AbstractRenderer
  {
    TopEmbeddedRenderer(JTabbedPane x0, PlasticTabbedPaneUI.1 x1)
    {
      this(x0);
    }
    
    private TopEmbeddedRenderer(JTabbedPane tabPane)
    {
      super(null);
    }
    
    protected Insets getTabAreaInsets(Insets insets)
    {
      return EMPTY_INSETS;
    }
    
    protected Insets getContentBorderInsets(Insets defaultInsets)
    {
      return NORTH_INSETS;
    }
    
    protected Insets getTabInsets(int tabIndex, Insets tabInsets)
    {
      return new Insets(top, left + 1, bottom, right);
    }
    
    protected Insets getSelectedTabPadInsets()
    {
      return EMPTY_INSETS;
    }
    
    protected void paintTabBackground(Graphics g, int tabIndex, int x, int y, int w, int h, boolean isSelected)
    {
      g.setColor(selectColor);
      g.fillRect(x, y, w, h);
    }
    
    protected void paintTabBorder(Graphics g, int tabIndex, int x, int y, int w, int h, boolean isSelected)
    {
      g.translate(x, y);
      
      int right = w;
      int bottom = h;
      if (isFirstDisplayedTab(tabIndex, x, tabPane.getBounds().x))
      {
        if (isSelected)
        {
          g.setColor(selectHighlight);
          
          g.fillRect(0, 0, 1, bottom);
          
          g.fillRect(0, 0, right - 1, 1);
          
          g.fillRect(right - 1, 0, 1, bottom);
          g.setColor(shadowColor);
          
          g.fillRect(right - 1, 0, 1, 1);
          
          g.fillRect(right, 1, 1, bottom);
        }
      }
      else if (isSelected)
      {
        g.setColor(selectHighlight);
        
        g.fillRect(1, 1, 1, bottom - 1);
        
        g.fillRect(2, 0, right - 3, 1);
        
        g.fillRect(right - 1, 1, 1, bottom - 1);
        g.setColor(shadowColor);
        
        g.fillRect(0, 1, 1, bottom - 1);
        
        g.fillRect(1, 0, 1, 1);
        
        g.fillRect(right - 1, 0, 1, 1);
        
        g.fillRect(right, 1, 1, bottom);
      }
      else
      {
        g.setColor(shadowColor);
        g.fillRect(0, 0, 1, bottom + 2 - bottom / 2);
      }
      g.translate(-x, -y);
    }
    
    protected void paintContentBorderTopEdge(Graphics g, int x, int y, int w, int h, boolean drawBroken, Rectangle selRect, boolean isContentBorderPainted)
    {
      g.setColor(shadowColor);
      g.fillRect(x, y, w, 1);
    }
    
    protected void paintFocusIndicator(Graphics g, Rectangle[] rects, int tabIndex, Rectangle iconRect, Rectangle textRect, boolean isSelected) {}
  }
  
  private static final class TopRenderer
    extends PlasticTabbedPaneUI.AbstractRenderer
  {
    TopRenderer(JTabbedPane x0, PlasticTabbedPaneUI.1 x1)
    {
      this(x0);
    }
    
    private TopRenderer(JTabbedPane tabPane)
    {
      super(null);
    }
    
    protected Insets getTabAreaInsets(Insets defaultInsets)
    {
      return new Insets(top, left + 4, bottom, right);
    }
    
    protected int getTabLabelShiftY(int tabIndex, boolean isSelected)
    {
      return isSelected ? -1 : 0;
    }
    
    protected int getTabRunOverlay(int tabRunOverlay)
    {
      return tabRunOverlay - 2;
    }
    
    protected int getTabRunIndent(int run)
    {
      return 6 * run;
    }
    
    protected Insets getSelectedTabPadInsets()
    {
      return NORTH_INSETS;
    }
    
    protected Insets getTabInsets(int tabIndex, Insets tabInsets)
    {
      return new Insets(top - 1, left - 4, bottom, right - 4);
    }
    
    protected void paintFocusIndicator(Graphics g, Rectangle[] rects, int tabIndex, Rectangle iconRect, Rectangle textRect, boolean isSelected)
    {
      if ((!tabPane.hasFocus()) || (!isSelected)) {
        return;
      }
      Rectangle tabRect = rects[tabIndex];
      int top = y + 1;
      int left = x + 4;
      int height = height - 3;
      int width = width - 9;
      g.setColor(focus);
      g.drawRect(left, top, width, height);
    }
    
    protected void paintTabBackground(Graphics g, int tabIndex, int x, int y, int w, int h, boolean isSelected)
    {
      int sel = isSelected ? 0 : 1;
      g.setColor(selectColor);
      g.fillRect(x, y + sel, w, h / 2);
      g.fillRect(x - 1, y + sel + h / 2, w + 2, h - h / 2);
    }
    
    protected void paintTabBorder(Graphics g, int tabIndex, int x, int y, int w, int h, boolean isSelected)
    {
      g.translate(x - 4, y);
      
      int top = 0;
      int right = w + 6;
      
      g.setColor(selectHighlight);
      
      g.drawLine(1, h - 1, 4, top + 4);
      g.fillRect(5, top + 2, 1, 2);
      g.fillRect(6, top + 1, 1, 1);
      
      g.fillRect(7, top, right - 12, 1);
      
      g.setColor(darkShadow);
      g.drawLine(right, h - 1, right - 3, top + 4);
      g.fillRect(right - 4, top + 2, 1, 2);
      g.fillRect(right - 5, top + 1, 1, 1);
      
      g.translate(-x + 4, -y);
    }
    
    protected void paintContentBorderTopEdge(Graphics g, int x, int y, int w, int h, boolean drawBroken, Rectangle selRect, boolean isContentBorderPainted)
    {
      int right = x + w - 1;
      int top = y;
      g.setColor(selectHighlight);
      if ((drawBroken) && (x >= x) && (x <= x + w))
      {
        g.fillRect(x, top, x - 2 - x, 1);
        if (x + width < x + w - 2) {
          g.fillRect(x + width + 2, top, right - 2 - x - width, 1);
        } else {
          g.fillRect(x + w - 2, top, 1, 1);
        }
      }
      else
      {
        g.fillRect(x, top, w - 1, 1);
      }
    }
    
    protected int getTabsOverlay()
    {
      return 6;
    }
  }
}

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

import java.awt.Color;
import java.beans.PropertyChangeEvent;
import javax.swing.JComponent;
import javax.swing.UIManager;
import javax.swing.plaf.ComponentUI;
import javax.swing.plaf.UIResource;
import javax.swing.plaf.basic.BasicTextAreaUI;
import javax.swing.text.JTextComponent;

public final class PlasticTextAreaUI
  extends BasicTextAreaUI
{
  public static ComponentUI createUI(JComponent c)
  {
    return new PlasticTextAreaUI();
  }
  
  public void installUI(JComponent c)
  {
    super.installUI(c);
    updateBackground((JTextComponent)c);
  }
  
  protected void propertyChange(PropertyChangeEvent evt)
  {
    super.propertyChange(evt);
    String propertyName = evt.getPropertyName();
    if (("editable".equals(propertyName)) || ("enabled".equals(propertyName))) {
      updateBackground((JTextComponent)evt.getSource());
    }
  }
  
  private void updateBackground(JTextComponent c)
  {
    Color background = c.getBackground();
    if (!(background instanceof UIResource)) {
      return;
    }
    Color newColor = null;
    if (!c.isEnabled()) {
      newColor = UIManager.getColor("TextArea.disabledBackground");
    }
    if ((newColor == null) && (!c.isEditable())) {
      newColor = UIManager.getColor("TextArea.inactiveBackground");
    }
    if (newColor == null) {
      newColor = UIManager.getColor("TextArea.background");
    }
    if ((newColor != null) && (newColor != background)) {
      c.setBackground(newColor);
    }
  }
}

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

import javax.swing.JComponent;
import javax.swing.plaf.ComponentUI;
import javax.swing.plaf.metal.MetalTextFieldUI;
import javax.swing.text.Caret;

public final class PlasticTextFieldUI
  extends MetalTextFieldUI
{
  public static ComponentUI createUI(JComponent c)
  {
    return new PlasticTextFieldUI();
  }
  
  protected Caret createCaret()
  {
    return new PlasticFieldCaret();
  }
}

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

import com.jgoodies.looks.FontPolicy;
import com.jgoodies.looks.FontSet;
import java.awt.Color;
import javax.swing.plaf.ColorUIResource;
import javax.swing.plaf.FontUIResource;
import javax.swing.plaf.metal.DefaultMetalTheme;

public abstract class PlasticTheme
  extends DefaultMetalTheme
{
  public static final Color DARKEN_START = new Color(0, 0, 0, 0);
  public static final Color DARKEN_STOP = new Color(0, 0, 0, 64);
  public static final Color LT_DARKEN_STOP = new Color(0, 0, 0, 32);
  public static final Color BRIGHTEN_START = new Color(255, 255, 255, 0);
  public static final Color BRIGHTEN_STOP = new Color(255, 255, 255, 128);
  public static final Color LT_BRIGHTEN_STOP = new Color(255, 255, 255, 64);
  protected static final ColorUIResource WHITE = new ColorUIResource(255, 255, 255);
  protected static final ColorUIResource BLACK = new ColorUIResource(0, 0, 0);
  private FontSet fontSet;
  
  protected ColorUIResource getBlack()
  {
    return BLACK;
  }
  
  protected ColorUIResource getWhite()
  {
    return WHITE;
  }
  
  public ColorUIResource getSystemTextColor()
  {
    return getControlInfo();
  }
  
  public ColorUIResource getTitleTextColor()
  {
    return getPrimary1();
  }
  
  public ColorUIResource getMenuForeground()
  {
    return getControlInfo();
  }
  
  public ColorUIResource getMenuItemBackground()
  {
    return getMenuBackground();
  }
  
  public ColorUIResource getMenuItemSelectedBackground()
  {
    return getMenuSelectedBackground();
  }
  
  public ColorUIResource getMenuItemSelectedForeground()
  {
    return getMenuSelectedForeground();
  }
  
  public ColorUIResource getSimpleInternalFrameForeground()
  {
    return getWhite();
  }
  
  public ColorUIResource getSimpleInternalFrameBackground()
  {
    return getPrimary1();
  }
  
  public ColorUIResource getToggleButtonCheckColor()
  {
    return getPrimary1();
  }
  
  public FontUIResource getTitleTextFont()
  {
    return getFontSet().getTitleFont();
  }
  
  public FontUIResource getControlTextFont()
  {
    return getFontSet().getControlFont();
  }
  
  public FontUIResource getMenuTextFont()
  {
    return getFontSet().getMenuFont();
  }
  
  public FontUIResource getSubTextFont()
  {
    return getFontSet().getSmallFont();
  }
  
  public FontUIResource getSystemTextFont()
  {
    return getFontSet().getControlFont();
  }
  
  public FontUIResource getUserTextFont()
  {
    return getFontSet().getControlFont();
  }
  
  public FontUIResource getWindowTitleFont()
  {
    return getFontSet().getWindowTitleFont();
  }
  
  protected FontSet getFontSet()
  {
    if (fontSet == null)
    {
      FontPolicy policy = PlasticLookAndFeel.getFontPolicy();
      fontSet = policy.getFontSet("Plastic", null);
    }
    return fontSet;
  }
  
  public boolean equals(Object o)
  {
    if (this == o) {
      return true;
    }
    if (o == null) {
      return false;
    }
    return getClass().equals(o.getClass());
  }
  
  public int hashCode()
  {
    return getClass().hashCode();
  }
}

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

import java.awt.Container;
import java.awt.Dimension;
import java.awt.Font;
import java.awt.FontMetrics;
import java.awt.Graphics;
import java.awt.Insets;
import java.awt.Rectangle;
import javax.swing.AbstractButton;
import javax.swing.ButtonModel;
import javax.swing.JComponent;
import javax.swing.JToolBar;
import javax.swing.SwingUtilities;
import javax.swing.UIManager;
import javax.swing.plaf.ComponentUI;
import javax.swing.plaf.metal.MetalToggleButtonUI;
import javax.swing.text.View;

public class PlasticToggleButtonUI
  extends MetalToggleButtonUI
{
  private static final PlasticToggleButtonUI INSTANCE = new PlasticToggleButtonUI();
  protected static final String HTML_KEY = "html";
  private boolean borderPaintsFocus;
  
  public static ComponentUI createUI(JComponent b)
  {
    return INSTANCE;
  }
  
  public void installDefaults(AbstractButton b)
  {
    super.installDefaults(b);
    borderPaintsFocus = Boolean.TRUE.equals(UIManager.get("ToggleButton.borderPaintsFocus"));
  }
  
  public void update(Graphics g, JComponent c)
  {
    AbstractButton b = (AbstractButton)c;
    if (c.isOpaque()) {
      if (isToolBarButton(b))
      {
        c.setOpaque(false);
      }
      else if (b.isContentAreaFilled())
      {
        g.setColor(c.getBackground());
        g.fillRect(0, 0, c.getWidth(), c.getHeight());
        if (is3D(b))
        {
          Rectangle r = new Rectangle(1, 1, c.getWidth() - 2, c.getHeight() - 1);
          
          PlasticUtils.add3DEffekt(g, r);
        }
      }
    }
    paint(g, c);
  }
  
  protected void paintFocus(Graphics g, AbstractButton b, Rectangle viewRect, Rectangle textRect, Rectangle iconRect)
  {
    if (borderPaintsFocus) {
      return;
    }
    boolean isDefault = false;
    int topLeftInset = isDefault ? 3 : 2;
    int width = b.getWidth() - 1 - topLeftInset * 2;
    int height = b.getHeight() - 1 - topLeftInset * 2;
    
    g.setColor(getFocusColor());
    g.drawRect(topLeftInset, topLeftInset, width - 1, height - 1);
  }
  
  public void paint(Graphics g, JComponent c)
  {
    AbstractButton b = (AbstractButton)c;
    ButtonModel model = b.getModel();
    
    Dimension size = b.getSize();
    FontMetrics fm = g.getFontMetrics();
    
    Insets i = c.getInsets();
    
    Rectangle viewRect = new Rectangle(size);
    
    x += left;
    y += top;
    width -= right + x;
    height -= bottom + y;
    
    Rectangle iconRect = new Rectangle();
    Rectangle textRect = new Rectangle();
    
    Font f = c.getFont();
    g.setFont(f);
    
    String text = SwingUtilities.layoutCompoundLabel(c, fm, b.getText(), b.getIcon(), b.getVerticalAlignment(), b.getHorizontalAlignment(), b.getVerticalTextPosition(), b.getHorizontalTextPosition(), viewRect, iconRect, textRect, b.getText() == null ? 0 : b.getIconTextGap());
    
    g.setColor(b.getBackground());
    if (((model.isArmed()) && (model.isPressed())) || (model.isSelected())) {
      paintButtonPressed(g, b);
    }
    if (b.getIcon() != null) {
      paintIcon(g, b, iconRect);
    }
    if ((text != null) && (!text.equals("")))
    {
      View v = (View)c.getClientProperty("html");
      if (v != null) {
        v.paint(g, textRect);
      } else {
        paintText(g, c, textRect, text);
      }
    }
    if ((b.isFocusPainted()) && (b.hasFocus())) {
      paintFocus(g, b, viewRect, textRect, iconRect);
    }
  }
  
  protected boolean isToolBarButton(AbstractButton b)
  {
    Container parent = b.getParent();
    return (parent != null) && (((parent instanceof JToolBar)) || ((parent.getParent() instanceof JToolBar)));
  }
  
  protected boolean is3D(AbstractButton b)
  {
    if (PlasticUtils.force3D(b)) {
      return true;
    }
    if (PlasticUtils.forceFlat(b)) {
      return false;
    }
    ButtonModel model = b.getModel();
    return (PlasticUtils.is3D("ToggleButton.")) && (b.isBorderPainted()) && (model.isEnabled()) && (!model.isPressed());
  }
}

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

import javax.swing.JComponent;
import javax.swing.plaf.ComponentUI;
import javax.swing.plaf.basic.BasicToolBarSeparatorUI;

public final class PlasticToolBarSeparatorUI
  extends BasicToolBarSeparatorUI
{
  private static ComponentUI toolBarSeparatorUI;
  
  public static ComponentUI createUI(JComponent c)
  {
    if (toolBarSeparatorUI == null) {
      toolBarSeparatorUI = new PlasticToolBarSeparatorUI();
    }
    return toolBarSeparatorUI;
  }
}

/* Location:
 * Qualified Name:     com.jgoodies.looks.plastic.PlasticToolBarSeparatorUI
 * 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 PlasticToolBarUI$1
  implements PropertyChangeListener
{
  private final PlasticToolBarUI this$0;
  
  PlasticToolBarUI$1(PlasticToolBarUI paramPlasticToolBarUI) {}
  
  public void propertyChange(PropertyChangeEvent e)
  {
    String prop = e.getPropertyName();
    if ((prop.equals("jgoodies.headerStyle")) || (prop.equals("Plastic.borderStyle"))) {
      PlasticToolBarUI.access$000(this$0);
    }
  }
}

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

import com.jgoodies.looks.BorderStyle;
import com.jgoodies.looks.HeaderStyle;
import java.awt.Component;
import java.awt.Container;
import java.awt.Graphics;
import java.awt.Rectangle;
import java.beans.PropertyChangeEvent;
import java.beans.PropertyChangeListener;
import javax.swing.AbstractButton;
import javax.swing.JComponent;
import javax.swing.JToolBar;
import javax.swing.LookAndFeel;
import javax.swing.border.Border;
import javax.swing.plaf.ComponentUI;
import javax.swing.plaf.metal.MetalToolBarUI;

public class PlasticToolBarUI
  extends MetalToolBarUI
{
  private static final String PROPERTY_PREFIX = "ToolBar.";
  private PropertyChangeListener listener;
  
  public static ComponentUI createUI(JComponent b)
  {
    return new PlasticToolBarUI();
  }
  
  protected Border createRolloverBorder()
  {
    return PlasticBorders.getRolloverButtonBorder();
  }
  
  protected void setBorderToRollover(Component c)
  {
    if ((c instanceof AbstractButton))
    {
      super.setBorderToRollover(c);
    }
    else if ((c instanceof Container))
    {
      Container cont = (Container)c;
      for (int i = 0; i < cont.getComponentCount(); i++) {
        super.setBorderToRollover(cont.getComponent(i));
      }
    }
  }
  
  protected void installDefaults()
  {
    super.installDefaults();
    installSpecialBorder();
  }
  
  protected void installListeners()
  {
    super.installListeners();
    listener = createBorderStyleListener();
    toolBar.addPropertyChangeListener(listener);
  }
  
  protected void uninstallListeners()
  {
    toolBar.removePropertyChangeListener(listener);
    super.uninstallListeners();
  }
  
  private PropertyChangeListener createBorderStyleListener()
  {
    new PropertyChangeListener()
    {
      public void propertyChange(PropertyChangeEvent e)
      {
        String prop = e.getPropertyName();
        if ((prop.equals("jgoodies.headerStyle")) || (prop.equals("Plastic.borderStyle"))) {
          PlasticToolBarUI.this.installSpecialBorder();
        }
      }
    };
  }
  
  private void installSpecialBorder()
  {
    BorderStyle borderStyle = BorderStyle.from(toolBar, "Plastic.borderStyle");
    String suffix;
    String suffix;
    if (borderStyle == BorderStyle.EMPTY)
    {
      suffix = "emptyBorder";
    }
    else
    {
      String suffix;
      if (borderStyle == BorderStyle.ETCHED)
      {
        suffix = "etchedBorder";
      }
      else
      {
        String suffix;
        if (borderStyle == BorderStyle.SEPARATOR)
        {
          suffix = "separatorBorder";
        }
        else
        {
          HeaderStyle headerStyle = HeaderStyle.from(toolBar);
          String suffix;
          if (headerStyle == HeaderStyle.BOTH)
          {
            suffix = "headerBorder";
          }
          else
          {
            String suffix;
            if ((headerStyle == HeaderStyle.SINGLE) && (is3D())) {
              suffix = "etchedBorder";
            } else {
              suffix = "border";
            }
          }
        }
      }
    }
    LookAndFeel.installBorder(toolBar, "ToolBar." + suffix);
  }
  
  public void update(Graphics g, JComponent c)
  {
    if (c.isOpaque())
    {
      g.setColor(c.getBackground());
      g.fillRect(0, 0, c.getWidth(), c.getHeight());
      if (is3D())
      {
        Rectangle bounds = new Rectangle(0, 0, c.getWidth(), c.getHeight());
        
        boolean isHorizontal = ((JToolBar)c).getOrientation() == 0;
        
        PlasticUtils.addLight3DEffekt(g, bounds, isHorizontal);
      }
    }
    paint(g, c);
  }
  
  private boolean is3D()
  {
    if (PlasticUtils.force3D(toolBar)) {
      return true;
    }
    if (PlasticUtils.forceFlat(toolBar)) {
      return false;
    }
    return (PlasticUtils.is3D("ToolBar.")) && (HeaderStyle.from(toolBar) != null) && (BorderStyle.from(toolBar, "Plastic.borderStyle") != BorderStyle.EMPTY);
  }
}

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

class PlasticTreeUI$1 {}

/* Location:
 * Qualified Name:     com.jgoodies.looks.plastic.PlasticTreeUI.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;

class PlasticTreeUI$LineStyleHandler
  implements PropertyChangeListener
{
  private final PlasticTreeUI this$0;
  
  PlasticTreeUI$LineStyleHandler(PlasticTreeUI x0, PlasticTreeUI.1 x1)
  {
    this(x0);
  }
  
  public void propertyChange(PropertyChangeEvent e)
  {
    String name = e.getPropertyName();
    Object value = e.getNewValue();
    if (name.equals("JTree.lineStyle")) {
      PlasticTreeUI.access$100(this$0, value);
    }
  }
  
  private PlasticTreeUI$LineStyleHandler(PlasticTreeUI paramPlasticTreeUI) {}
}

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

import java.awt.Component;
import java.awt.Graphics;
import java.beans.PropertyChangeEvent;
import java.beans.PropertyChangeListener;
import javax.swing.Icon;
import javax.swing.JComponent;
import javax.swing.plaf.ComponentUI;
import javax.swing.plaf.basic.BasicTreeUI;

public final class PlasticTreeUI
  extends BasicTreeUI
{
  private boolean linesEnabled;
  private PropertyChangeListener lineStyleHandler;
  
  public PlasticTreeUI()
  {
    linesEnabled = true;
  }
  
  public static ComponentUI createUI(JComponent b)
  {
    return new PlasticTreeUI();
  }
  
  public void installUI(JComponent c)
  {
    super.installUI(c);
    updateLineStyle(c.getClientProperty("JTree.lineStyle"));
    lineStyleHandler = new LineStyleHandler(null);
    c.addPropertyChangeListener(lineStyleHandler);
  }
  
  public void uninstallUI(JComponent c)
  {
    c.removePropertyChangeListener(lineStyleHandler);
    super.uninstallUI(c);
  }
  
  protected void paintVerticalLine(Graphics g, JComponent c, int x, int top, int bottom)
  {
    if (linesEnabled) {
      drawDashedVerticalLine(g, x, top, bottom);
    }
  }
  
  protected void paintHorizontalLine(Graphics g, JComponent c, int y, int left, int right)
  {
    if (linesEnabled) {
      drawDashedHorizontalLine(g, y, left, right);
    }
  }
  
  protected void drawCentered(Component c, Graphics graphics, Icon icon, int x, int y)
  {
    icon.paintIcon(c, graphics, x - icon.getIconWidth() / 2 - 1, y - icon.getIconHeight() / 2);
  }
  
  private void updateLineStyle(Object lineStyle)
  {
    linesEnabled = (!"None".equals(lineStyle));
  }
  
  private class LineStyleHandler
    implements PropertyChangeListener
  {
    LineStyleHandler(PlasticTreeUI.1 x1)
    {
      this();
    }
    
    public void propertyChange(PropertyChangeEvent e)
    {
      String name = e.getPropertyName();
      Object value = e.getNewValue();
      if (name.equals("JTree.lineStyle")) {
        PlasticTreeUI.this.updateLineStyle(value);
      }
    }
    
    private LineStyleHandler() {}
  }
}

/* Location:
 * Qualified Name:     com.jgoodies.looks.plastic.PlasticTreeUI
 * 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.Component;
import java.awt.ComponentOrientation;
import java.awt.GradientPaint;
import java.awt.Graphics;
import java.awt.Graphics2D;
import java.awt.Rectangle;
import javax.swing.JComponent;
import javax.swing.UIManager;

public final class PlasticUtils
{
  private static final float FRACTION_3D = 0.5F;
  
  static void drawDark3DBorder(Graphics g, int x, int y, int w, int h)
  {
    drawFlush3DBorder(g, x, y, w, h);
    g.setColor(PlasticLookAndFeel.getControl());
    g.drawLine(x + 1, y + 1, 1, h - 3);
    g.drawLine(y + 1, y + 1, w - 3, 1);
  }
  
  static void drawDisabledBorder(Graphics g, int x, int y, int w, int h)
  {
    g.setColor(PlasticLookAndFeel.getControlShadow());
    drawRect(g, x, y, w - 1, h - 1);
  }
  
  static void drawFlush3DBorder(Graphics g, int x, int y, int w, int h)
  {
    g.translate(x, y);
    g.setColor(PlasticLookAndFeel.getControlHighlight());
    drawRect(g, 1, 1, w - 2, h - 2);
    g.drawLine(0, h - 1, 0, h - 1);
    g.drawLine(w - 1, 0, w - 1, 0);
    g.setColor(PlasticLookAndFeel.getControlDarkShadow());
    drawRect(g, 0, 0, w - 2, h - 2);
    g.translate(-x, -y);
  }
  
  static void drawPressed3DBorder(Graphics g, int x, int y, int w, int h)
  {
    g.translate(x, y);
    drawFlush3DBorder(g, 0, 0, w, h);
    g.setColor(PlasticLookAndFeel.getControlShadow());
    g.drawLine(1, 1, 1, h - 3);
    g.drawLine(1, 1, w - 3, 1);
    g.translate(-x, -y);
  }
  
  static void drawButtonBorder(Graphics g, int x, int y, int w, int h, boolean active)
  {
    if (active) {
      drawActiveButtonBorder(g, x, y, w, h);
    } else {
      drawFlush3DBorder(g, x, y, w, h);
    }
  }
  
  static void drawActiveButtonBorder(Graphics g, int x, int y, int w, int h)
  {
    drawFlush3DBorder(g, x, y, w, h);
    g.setColor(PlasticLookAndFeel.getPrimaryControl());
    g.drawLine(x + 1, y + 1, x + 1, h - 3);
    g.drawLine(x + 1, y + 1, w - 3, x + 1);
    g.setColor(PlasticLookAndFeel.getPrimaryControlDarkShadow());
    g.drawLine(x + 2, h - 2, w - 2, h - 2);
    g.drawLine(w - 2, y + 2, w - 2, h - 2);
  }
  
  static void drawDefaultButtonBorder(Graphics g, int x, int y, int w, int h, boolean active)
  {
    drawButtonBorder(g, x + 1, y + 1, w - 1, h - 1, active);
    g.translate(x, y);
    g.setColor(PlasticLookAndFeel.getControlDarkShadow());
    drawRect(g, 0, 0, w - 3, h - 3);
    g.drawLine(w - 2, 0, w - 2, 0);
    g.drawLine(0, h - 2, 0, h - 2);
    g.setColor(PlasticLookAndFeel.getControl());
    g.drawLine(w - 1, 0, w - 1, 0);
    g.drawLine(0, h - 1, 0, h - 1);
    g.translate(-x, -y);
  }
  
  static void drawDefaultButtonPressedBorder(Graphics g, int x, int y, int w, int h)
  {
    drawPressed3DBorder(g, x + 1, y + 1, w - 1, h - 1);
    g.translate(x, y);
    g.setColor(PlasticLookAndFeel.getControlDarkShadow());
    drawRect(g, 0, 0, w - 3, h - 3);
    g.drawLine(w - 2, 0, w - 2, 0);
    g.drawLine(0, h - 2, 0, h - 2);
    g.setColor(PlasticLookAndFeel.getControl());
    g.drawLine(w - 1, 0, w - 1, 0);
    g.drawLine(0, h - 1, 0, h - 1);
    g.translate(-x, -y);
  }
  
  static void drawThinFlush3DBorder(Graphics g, int x, int y, int w, int h)
  {
    g.translate(x, y);
    g.setColor(PlasticLookAndFeel.getControlHighlight());
    g.drawLine(0, 0, w - 2, 0);
    g.drawLine(0, 0, 0, h - 2);
    g.setColor(PlasticLookAndFeel.getControlDarkShadow());
    g.drawLine(w - 1, 0, w - 1, h - 1);
    g.drawLine(0, h - 1, w - 1, h - 1);
    g.translate(-x, -y);
  }
  
  static void drawThinPressed3DBorder(Graphics g, int x, int y, int w, int h)
  {
    g.translate(x, y);
    g.setColor(PlasticLookAndFeel.getControlDarkShadow());
    g.drawLine(0, 0, w - 2, 0);
    g.drawLine(0, 0, 0, h - 2);
    g.setColor(PlasticLookAndFeel.getControlHighlight());
    g.drawLine(w - 1, 0, w - 1, h - 1);
    g.drawLine(0, h - 1, w - 1, h - 1);
    g.translate(-x, -y);
  }
  
  static boolean isLeftToRight(Component c)
  {
    return c.getComponentOrientation().isLeftToRight();
  }
  
  static boolean is3D(String keyPrefix)
  {
    Object value = UIManager.get(keyPrefix + "is3DEnabled");
    return Boolean.TRUE.equals(value);
  }
  
  static boolean force3D(JComponent c)
  {
    Object value = c.getClientProperty("Plastic.is3D");
    return Boolean.TRUE.equals(value);
  }
  
  static boolean forceFlat(JComponent c)
  {
    Object value = c.getClientProperty("Plastic.is3D");
    return Boolean.FALSE.equals(value);
  }
  
  private static void add3DEffekt(Graphics g, Rectangle r, boolean isHorizontal, Color startC0, Color stopC0, Color startC1, Color stopC1)
  {
    Graphics2D g2 = (Graphics2D)g;
    int yd1;
    int width;
    int height;
    int xb0;
    int yb0;
    int xb1;
    int yb1;
    int xd0;
    int yd0;
    int xd1;
    int yd1;
    if (isHorizontal)
    {
      int width = width;
      int height = (int)(height * 0.5F);
      int xb0 = x;
      int yb0 = y;
      int xb1 = xb0;
      int yb1 = yb0 + height;
      int xd0 = xb1;
      int yd0 = yb1;
      int xd1 = xd0;
      yd1 = y + height;
    }
    else
    {
      width = (int)(width * 0.5F);
      height = height;
      xb0 = x;
      yb0 = y;
      xb1 = xb0 + width;
      yb1 = yb0;
      xd0 = xb1;
      yd0 = yb0;
      xd1 = x + width;
      yd1 = yd0;
    }
    g2.setPaint(new GradientPaint(xb0, yb0, stopC0, xb1, yb1, startC0));
    g2.fillRect(x, y, width, height);
    g2.setPaint(new GradientPaint(xd0, yd0, startC1, xd1, yd1, stopC1));
    g2.fillRect(xd0, yd0, width, height);
  }
  
  static void add3DEffekt(Graphics g, Rectangle r)
  {
    Color brightenStop = UIManager.getColor("Plastic.brightenStop");
    if (null == brightenStop) {
      brightenStop = PlasticTheme.BRIGHTEN_STOP;
    }
    Graphics2D g2 = (Graphics2D)g;
    int border = 10;
    g2.setPaint(new GradientPaint(x, y, brightenStop, x + border, y, PlasticTheme.BRIGHTEN_START));
    g2.fillRect(x, y, border, height);
    int x = x + width - border;
    int y = y;
    g2.setPaint(new GradientPaint(x, y, PlasticTheme.DARKEN_START, x + border, y, PlasticTheme.LT_DARKEN_STOP));
    g2.fillRect(x, y, border, height);
    
    add3DEffekt(g, r, true, PlasticTheme.BRIGHTEN_START, brightenStop, PlasticTheme.DARKEN_START, PlasticTheme.LT_DARKEN_STOP);
  }
  
  static void addLight3DEffekt(Graphics g, Rectangle r, boolean isHorizontal)
  {
    Color ltBrightenStop = UIManager.getColor("Plastic.ltBrightenStop");
    if (null == ltBrightenStop) {
      ltBrightenStop = PlasticTheme.LT_BRIGHTEN_STOP;
    }
    add3DEffekt(g, r, isHorizontal, PlasticTheme.BRIGHTEN_START, ltBrightenStop, PlasticTheme.DARKEN_START, PlasticTheme.LT_DARKEN_STOP);
  }
  
  public static void addLight3DEffekt(Graphics g, Rectangle r)
  {
    Color ltBrightenStop = UIManager.getColor("Plastic.ltBrightenStop");
    if (null == ltBrightenStop) {
      ltBrightenStop = PlasticTheme.LT_BRIGHTEN_STOP;
    }
    add3DEffekt(g, r, true, PlasticTheme.DARKEN_START, PlasticTheme.LT_DARKEN_STOP, PlasticTheme.BRIGHTEN_START, ltBrightenStop);
  }
  
  private static void drawRect(Graphics g, int x, int y, int w, int h)
  {
    g.fillRect(x, y, w + 1, 1);
    g.fillRect(x, y + 1, 1, h);
    g.fillRect(x + 1, y + h, w, 1);
    g.fillRect(x + w, y + 1, 1, h);
  }
}

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

class PlasticXPBorders$1 {}

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

import java.awt.Component;
import java.awt.Graphics;
import java.awt.Insets;
import javax.swing.AbstractButton;
import javax.swing.ButtonModel;
import javax.swing.JToggleButton;

final class PlasticXPBorders$RolloverButtonBorder
  extends PlasticXPBorders.XPButtonBorder
{
  PlasticXPBorders$RolloverButtonBorder(PlasticXPBorders.1 x0)
  {
    this();
  }
  
  private PlasticXPBorders$RolloverButtonBorder()
  {
    super(new Insets(3, 3, 3, 3));
  }
  
  public void paintBorder(Component c, Graphics g, int x, int y, int w, int h)
  {
    AbstractButton b = (AbstractButton)c;
    ButtonModel model = b.getModel();
    if (!model.isEnabled()) {
      return;
    }
    if (!(c instanceof JToggleButton))
    {
      if ((model.isRollover()) && ((!model.isPressed()) || (model.isArmed()))) {
        super.paintBorder(c, g, x, y, w, h);
      }
      return;
    }
    if (model.isRollover())
    {
      if ((model.isPressed()) && (model.isArmed())) {
        PlasticXPUtils.drawPressedButtonBorder(g, x, y, w, h);
      } else {
        PlasticXPUtils.drawPlainButtonBorder(g, x, y, w, h);
      }
    }
    else if (model.isSelected()) {
      PlasticXPUtils.drawPressedButtonBorder(g, x, y, w, h);
    }
  }
}

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

import java.awt.Component;
import java.awt.Graphics;
import java.awt.Insets;
import javax.swing.AbstractButton;
import javax.swing.ButtonModel;
import javax.swing.JButton;
import javax.swing.border.AbstractBorder;
import javax.swing.plaf.UIResource;

class PlasticXPBorders$XPButtonBorder
  extends AbstractBorder
  implements UIResource
{
  protected final Insets insets;
  
  protected PlasticXPBorders$XPButtonBorder(Insets insets)
  {
    this.insets = insets;
  }
  
  public void paintBorder(Component c, Graphics g, int x, int y, int w, int h)
  {
    AbstractButton button = (AbstractBut
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-2019. Infinite Loop Ltd