com.miginfocom.util.gfx
Class SoftLineBorder

java.lang.Object
  extended by javax.swing.border.AbstractBorder
      extended by com.miginfocom.util.gfx.SoftLineBorder
All Implemented Interfaces:
java.io.Serializable, javax.swing.border.Border

public class SoftLineBorder
extends javax.swing.border.AbstractBorder

A line border of width 1 that has brighter corner pixels which makes it look somewhat rounded. Tree pixels in every corner is brighter and the absolute corner pixel can be transparent (not drawn)

See Also:
Serialized Form

Field Summary
protected  java.awt.Color b1Col
           
protected  java.awt.Color b2Col
           
protected  java.awt.Color col
           
protected  float perc
           
protected  boolean trans
           
 
Constructor Summary
SoftLineBorder(java.awt.Color color, float tintPercent, boolean transparentCorner)
          Creates a line border with the specified color
 
Method Summary
 boolean equals(java.lang.Object o)
           
 java.awt.Insets getBorderInsets(java.awt.Component c)
           
 java.awt.Color getColor()
          Returns the line color
 float getTintPercent()
          Returns the tint percentage
 boolean getTransparentCorner()
          Returns if the corner pixel should be transparent or not
 boolean isBorderOpaque()
           
 boolean isTransparentCorner()
          Returns if the corner pixel should be transparent or not
 void paintBorder(java.awt.Component c, java.awt.Graphics g, int x, int y, int w, int h)
          Paints the border.
 
Methods inherited from class javax.swing.border.AbstractBorder
getBaseline, getBaselineResizeBehavior, getBorderInsets, getInteriorRectangle, getInteriorRectangle
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

col

protected final java.awt.Color col

perc

protected float perc

trans

protected boolean trans

b1Col

protected transient java.awt.Color b1Col

b2Col

protected transient java.awt.Color b2Col
Constructor Detail

SoftLineBorder

public SoftLineBorder(java.awt.Color color,
                      float tintPercent,
                      boolean transparentCorner)
Creates a line border with the specified color

Parameters:
color - the color for the border
tintPercent - The percentage that the corner be brigher (> 0) darker or darker (< 0)
transparentCorner - If true, the corner pixels will be filled, otherwise they will be transparent
Method Detail

paintBorder

public void paintBorder(java.awt.Component c,
                        java.awt.Graphics g,
                        int x,
                        int y,
                        int w,
                        int h)
Paints the border.

Specified by:
paintBorder in interface javax.swing.border.Border
Overrides:
paintBorder in class javax.swing.border.AbstractBorder
Parameters:
c - Not used.
g - the paint graphics
x - the x position of the painted border
y - the y position of the painted border
w - the width of the painted border
h - the height of the painted border

getBorderInsets

public java.awt.Insets getBorderInsets(java.awt.Component c)
Specified by:
getBorderInsets in interface javax.swing.border.Border
Overrides:
getBorderInsets in class javax.swing.border.AbstractBorder

getColor

public java.awt.Color getColor()
Returns the line color

Returns:
The line color

isBorderOpaque

public boolean isBorderOpaque()
Specified by:
isBorderOpaque in interface javax.swing.border.Border
Overrides:
isBorderOpaque in class javax.swing.border.AbstractBorder

getTintPercent

public float getTintPercent()
Returns the tint percentage

Returns:
The tint percentage

isTransparentCorner

public boolean isTransparentCorner()
Returns if the corner pixel should be transparent or not

Returns:
If the corner pixel should be transparent or not

getTransparentCorner

public boolean getTransparentCorner()
Returns if the corner pixel should be transparent or not

Returns:
If the corner pixel should be transparent or not

equals

public boolean equals(java.lang.Object o)
Overrides:
equals in class java.lang.Object


Copyright © 2009 MiG InfoCom AB. All Rights Reserved.