/[classpath]/classpath/javax/swing/border/LineBorder.java
ViewVC logotype

Diff of /classpath/javax/swing/border/LineBorder.java

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.7.2.1 by gnu_andrew, Tue Aug 2 20:12:37 2005 UTC revision 1.7.2.2 by gnu_andrew, Wed Nov 2 00:43:49 2005 UTC
# Line 50  import java.awt.Insets; Line 50  import java.awt.Insets;
50   *   *
51   * @author Sascha Brawer (brawer@dandelis.ch)   * @author Sascha Brawer (brawer@dandelis.ch)
52   */   */
53  public class LineBorder  public class LineBorder extends AbstractBorder
   extends AbstractBorder  
54  {  {
55    /**    /**
56     * Determined using the <code>serialver</code> tool     * Determined using the <code>serialver</code> tool
# Line 71  public class LineBorder Line 70  public class LineBorder
70    /**    /**
71     * A shared instance of a gray, one pixel thick, plain LineBorder.     * A shared instance of a gray, one pixel thick, plain LineBorder.
72     * The singleton object is lazily created by {@link     * The singleton object is lazily created by {@link
73     * #createBlackGrayBorder()} upon its first invocation.     * #createGrayLineBorder()} upon its first invocation.
74     */     */
75    private static LineBorder grayLineBorder;    private static LineBorder grayLineBorder;
76    
# Line 213  public class LineBorder Line 212  public class LineBorder
212      {      {
213        g.setColor(lineColor);        g.setColor(lineColor);
214    
215        /* If width and height were not adjusted, the border would        // If width and height were not adjusted, the border would
216         * appear one pixel too large in both directions.        // appear one pixel too large in both directions.
        */  
217        width -= 1;        width -= 1;
218        height -= 1;        height -= 1;
219    
220        /* Blurred, too large appearance        // Blurred, too large appearance
221         * -----------------------------        // -----------------------------
222         * While Java 2D has introduced line strokes of arbitrary width,        // While Java 2D has introduced line strokes of arbitrary width,
223         * it seems desirable to keep this code independent of Java 2D.        // it seems desirable to keep this code independent of Java 2D.
224         * Therefore, multiple nested rectangles (or rounded rectangles)        // Therefore, multiple nested rectangles (or rounded rectangles)
225         * are drawn in order to simulate a line whose thickness is        // are drawn in order to simulate a line whose thickness is
226         * greater than one pixel.        // greater than one pixel.
227         *        //
228         * This hack causes a blurred appearance when anti-aliasing is        // This hack causes a blurred appearance when anti-aliasing is
229         * on. Interestingly enough, though, the Sun JDK 1.3.1 (at least        // on. Interestingly enough, though, the Sun JDK 1.3.1 (at least
230         * on MacOS X 10.1.5) shows exactly the same appearance under        // on MacOS X 10.1.5) shows exactly the same appearance under
231         * this condition. It thus seems likely that Sun does the same        // this condition. It thus seems likely that Sun does the same
232         * hack for simulating thick lines.  For this reason, the        // hack for simulating thick lines.  For this reason, the
233         * blurred appearance seems acceptable -- especially since GNU        // blurred appearance seems acceptable -- especially since GNU
234         * Classpath tries to be compatible with the Sun reference        // Classpath tries to be compatible with the Sun reference
235         * implementation.        // implementation.
        */  
236        for (int i = 0; i < thickness; i++)        for (int i = 0; i < thickness; i++)
237        {        {
238          if (roundedCorners)          if (roundedCorners)
# Line 340  public class LineBorder Line 337  public class LineBorder
337      return (!roundedCorners) && (lineColor.getAlpha() == 255);      return (!roundedCorners) && (lineColor.getAlpha() == 255);
338    }    }
339  }  }
   

Legend:
Removed from v.1.7.2.1  
changed lines
  Added in v.1.7.2.2

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26