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

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

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

revision 1.6.2.1 by gnu_andrew, Tue Aug 2 20:12:37 2005 UTC revision 1.6.2.2 by gnu_andrew, Wed Nov 2 00:43:49 2005 UTC
# Line 56  import java.awt.Insets; Line 56  import java.awt.Insets;
56   *   *
57   * @author Sascha Brawer (brawer@dandelis.ch)   * @author Sascha Brawer (brawer@dandelis.ch)
58   */   */
59  public class EtchedBorder  public class EtchedBorder extends AbstractBorder
   extends AbstractBorder  
60  {  {
61    /**    /**
62     * Determined using the <code>serialver</code> tool     * Determined using the <code>serialver</code> tool
# Line 199  public class EtchedBorder Line 198  public class EtchedBorder
198     * @param width the width of the available area for painting the border.     * @param width the width of the available area for painting the border.
199     * @param height the height of the available area for painting the border.     * @param height the height of the available area for painting the border.
200     */     */
201    public void paintBorder(Component c, Graphics  g,    public void paintBorder(Component c, Graphics  g, int x, int y, int width,
202                            int x, int y, int width, int height)                            int height)
203    {    {
204      switch (etchType)      switch (etchType)
205      {      {
# Line 270  public class EtchedBorder Line 269  public class EtchedBorder
269     */     */
270    public boolean isBorderOpaque()    public boolean isBorderOpaque()
271    {    {
272      /* If the colors are to be drived from the enclosed Component's      // If the colors are to be derived from the enclosed Component's
273       * background color, the border is guaranteed to be fully opaque      // background color, the border is guaranteed to be fully opaque
274       * because Color.brighten() and Color.darken() always return an      // because Color.brighten() and Color.darken() always return an
275       * opaque color.      // opaque color.
      */  
276      return      return
277        ((highlight == null) || (highlight.getAlpha() == 255))        ((highlight == null) || (highlight.getAlpha() == 255))
278        && ((shadow == null) || (shadow.getAlpha() == 255));        && ((shadow == null) || (shadow.getAlpha() == 255));
279    }    }
   
280        
281    /**    /**
282     * Returns the appearance of this EtchedBorder, which is either     * Returns the appearance of this EtchedBorder, which is either
# Line 310  public class EtchedBorder Line 307  public class EtchedBorder
307      else      else
308        return c.getBackground().brighter();        return c.getBackground().brighter();
309    }    }
310      
     
311    /**    /**
312     * Returns the color that will be used for highlighted parts when     * Returns the color that will be used for highlighted parts when
313     * painting the border, or <code>null</code> if that color will be     * painting the border, or <code>null</code> if that color will be
# Line 359  public class EtchedBorder Line 355  public class EtchedBorder
355     * Paints a two-pixel etching in two colors.     * Paints a two-pixel etching in two colors.
356     *     *
357     * <pre>     * <pre>
358     * @@@@@@@@@@@.     * +++++++++++.
359     * @.........@.    @ = color a     * +.........+.    + = color a
360     * @.        @.    . = color b     * +.        +.    . = color b
361     * @.        @.     * +.        +.
362     * @@@@@@@@@@@.     * +++++++++++.
363     * ............</pre>     * ............</pre>
364     *     *
365     * @param g the graphics for painting.     * @param g the graphics for painting.
# Line 374  public class EtchedBorder Line 370  public class EtchedBorder
370     * @param a one of the two colors.     * @param a one of the two colors.
371     * @param b the second of the two colors.     * @param b the second of the two colors.
372     */     */
373    private static void paintEtchedBorder(Graphics g,    private static void paintEtchedBorder(Graphics g, int x, int y, int width,
374                                          int x, int y, int width, int height,                                          int height, Color a, Color b)
                                         Color a, Color b)  
375    {    {
376      Color oldColor;      Color oldColor;
377    
# Line 387  public class EtchedBorder Line 382  public class EtchedBorder
382    
383      try      try
384      {      {
385        /* To understand this code, it might be helpful to look at the        // To understand this code, it might be helpful to look at the
386         * images that are included with the JavaDoc. They are located        // images that are included with the JavaDoc. They are located
387         * in the "doc-files" subdirectory. EtchedBorder-2.png might        // in the "doc-files" subdirectory. EtchedBorder-2.png might
388         * be especially informative.        // be especially informative.
        */  
389        g.setColor(a);        g.setColor(a);
390        g.drawRect(0, 0, width - 1, height - 1);        g.drawRect(0, 0, width - 1, height - 1);
391    
# Line 408  public class EtchedBorder Line 402  public class EtchedBorder
402      }      }
403    }    }
404  }  }
   

Legend:
Removed from v.1.6.2.1  
changed lines
  Added in v.1.6.2.2

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