I fixed several warnings in javax.swing.border, mostly API comment errors and empty blocks without comments. I also slightly reformatted some files in this package.
2005-10-18 Roman Kennke <[EMAIL PROTECTED]> * javax/swing/border/AbstractBorder.java: * javax/swing/border/BevelBorder.java: * javax/swing/border/Border.java: * javax/swing/border/CompoundBorder.java: * javax/swing/border/EmptyBorder.java: * javax/swing/border/EtchedBorder.java: * javax/swing/border/LineBorder.java: * javax/swing/border/MatteBorder.java: * javax/swing/border/SoftBevelBorder.java: * javax/swing/border/TitledBorder.java: Reformatted slightly. Filled emtpy blocks with comments. Fixed some slight API doc errors /Roman
Index: javax/swing/border/AbstractBorder.java =================================================================== RCS file: /cvsroot/classpath/classpath/javax/swing/border/AbstractBorder.java,v retrieving revision 1.9 diff -u -r1.9 AbstractBorder.java --- javax/swing/border/AbstractBorder.java 21 Jul 2005 16:11:10 -0000 1.9 +++ javax/swing/border/AbstractBorder.java 18 Oct 2005 20:19:14 -0000 @@ -52,20 +52,18 @@ * @author Sascha Brawer ([EMAIL PROTECTED]) * @author Ronald Veldema ([EMAIL PROTECTED]) */ -public abstract class AbstractBorder - implements Border, Serializable +public abstract class AbstractBorder implements Border, Serializable { static final long serialVersionUID = -545885975315191844L; - /** * Constructs a new AbstractBorder. */ - public AbstractBorder () + public AbstractBorder() { + // Nothing to do here. } - /** * Performs nothing, because the default implementation provided by * this class is an invisible, zero-width border. Subclasses will @@ -79,17 +77,15 @@ * @param width the width of the available area for painting the border. * @param height the height of the available area for painting the border. */ - public void paintBorder (Component c, Graphics g, - int x, int y, int width, int height) + public void paintBorder(Component c, Graphics g, int x, int y, int width, + int height) { - /* A previous version of Classpath had emitted a warning when - * this method was called. The warning was removed because it is - * perfectly legal for a subclass to not override the paintBorder - * method. An example would be EmptyBorder. - */ + // A previous version of Classpath had emitted a warning when + // this method was called. The warning was removed because it is + // perfectly legal for a subclass to not override the paintBorder + // method. An example would be EmptyBorder. } - /** * Measures the width of this border. * @@ -102,31 +98,29 @@ * * @see #getBorderInsets(java.awt.Component, java.awt.Insets) */ - public Insets getBorderInsets (Component c) + public Insets getBorderInsets(Component c) { - return new Insets (0, 0, 0, 0); + return new Insets(0, 0, 0, 0); } - /** * Determines the insets of this border. The implementation provided * by AbstractButton sets the <code>left</code>, <code>right</code>, * <code>top</code> and <code>bottom</code> fields of the passed * <code>insets</code> parameter to zero. * - * @param c the component whose border is to be measured. + * @param c the component whose border is to be measured * - * @return the same object that was passed for <code>insets</code>. + * @return the same object that was passed for <code>insets</code> * * @see #getBorderInsets(Component) */ - public Insets getBorderInsets (Component c, Insets insets) + public Insets getBorderInsets(Component c, Insets insets) { insets.left = insets.right = insets.top = insets.bottom = 0; return insets; } - /** * Determines whether or not this border is opaque. An opaque border * fills every pixel in its area when painting. Partially @@ -136,12 +130,11 @@ * * @return <code>false</code>. */ - public boolean isBorderOpaque () + public boolean isBorderOpaque() { return false; } - /** * Returns a rectangle that covers the specified area minus this * border. Components that wish to determine an area into which @@ -154,12 +147,11 @@ * @param width the width of the available area for the border. * @param height the height of the available area for the border. */ - public Rectangle getInteriorRectangle (Component c, - int x, int y, int width, int height) + public Rectangle getInteriorRectangle(Component c, int x, int y, int width, + int height) { return getInteriorRectangle (c, this, x, y, width, height); } - /** * Returns a rectangle that covers the specified area minus a @@ -173,8 +165,8 @@ * @param width the width of the available area for the border. * @param height the height of the available area for the border. */ - public static Rectangle getInteriorRectangle (Component c, Border b, - int x, int y, int width, int height) + public static Rectangle getInteriorRectangle(Component c, Border b, int x, + int y, int width, int height) { Insets borderInsets; Index: javax/swing/border/BevelBorder.java =================================================================== RCS file: /cvsroot/classpath/classpath/javax/swing/border/BevelBorder.java,v retrieving revision 1.8 diff -u -r1.8 BevelBorder.java --- javax/swing/border/BevelBorder.java 21 Jul 2005 16:11:10 -0000 1.8 +++ javax/swing/border/BevelBorder.java 18 Oct 2005 20:19:15 -0000 @@ -55,8 +55,7 @@ * * @author Sascha Brawer ([EMAIL PROTECTED]) */ -public class BevelBorder - extends AbstractBorder +public class BevelBorder extends AbstractBorder { /** * Determined using the <code>serialver</code> tool @@ -508,11 +507,11 @@ * Paints a two-pixel bevel in four colors. * * <pre> - * @@@@@@@@@@@@ - * @..........# @ = color a - * @. X# . = color b - * @. X# X = color c - * @.XXXXXXXXX# # = color d + * ++++++++++++ + * +..........# + = color a + * +. X# . = color b + * +. X# X = color c + * +.XXXXXXXXX# # = color d * ############</pre> * * @param g the graphics for painting. Index: javax/swing/border/Border.java =================================================================== RCS file: /cvsroot/classpath/classpath/javax/swing/border/Border.java,v retrieving revision 1.6 diff -u -r1.6 Border.java --- javax/swing/border/Border.java 2 Jul 2005 20:32:49 -0000 1.6 +++ javax/swing/border/Border.java 18 Oct 2005 20:19:15 -0000 @@ -77,9 +77,8 @@ * @param width the width of the available area for painting the border. * @param height the height of the available area for painting the border. */ - void paintBorder(Component c, Graphics g, - int x, int y, int width, int height); - + void paintBorder(Component c, Graphics g, int x, int y, int width, + int height); /** * Measures the width of this border. @@ -91,7 +90,6 @@ * width of the border at the respective edge. */ Insets getBorderInsets(Component c); - /** * Determines whether this border fills every pixel in its area Index: javax/swing/border/CompoundBorder.java =================================================================== RCS file: /cvsroot/classpath/classpath/javax/swing/border/CompoundBorder.java,v retrieving revision 1.9 diff -u -r1.9 CompoundBorder.java --- javax/swing/border/CompoundBorder.java 2 Jul 2005 20:32:49 -0000 1.9 +++ javax/swing/border/CompoundBorder.java 18 Oct 2005 20:19:15 -0000 @@ -48,8 +48,7 @@ * * @author Sascha Brawer ([EMAIL PROTECTED]) */ -public class CompoundBorder - extends AbstractBorder +public class CompoundBorder extends AbstractBorder { /** * Determined using the <code>serialver</code> tool @@ -57,7 +56,6 @@ */ static final long serialVersionUID = 9054540377030555103L; - /** * The inside border, which is painted between the bordered * Component and the outside border. It is valid for @@ -65,7 +63,6 @@ */ protected Border insideBorder; - /** * The outside border, which is painted outside both the * bordered Component and the inside border. It is valid for @@ -73,7 +70,6 @@ */ protected Border outsideBorder; - /** * Constructs a CompoundBorder whose inside and outside borders * are both <code>null</code>. While this does not really make @@ -83,12 +79,11 @@ * * @see EmptyBorder */ - public CompoundBorder () + public CompoundBorder() { this (null, null); } - /** * Constructs a CompoundBorder with the specified inside and * outside borders. @@ -103,13 +98,12 @@ * component. It is acceptable to pass <code>null</code>, in * which case no inside border is painted. */ - public CompoundBorder (Border outsideBorder, Border insideBorder) + public CompoundBorder(Border outsideBorder, Border insideBorder) { this.outsideBorder = outsideBorder; this.insideBorder = insideBorder; } - /** * Determines whether or not this border is opaque. An opaque * border fills every pixel in its area when painting. Partially @@ -119,20 +113,18 @@ * @return <code>true</code> if both the inside and outside borders * are opaque, or <code>false</code> otherwise. */ - public boolean isBorderOpaque () + public boolean isBorderOpaque() { - /* While it would be safe to assume true for the opacity of - * a null border, this behavior would not be according to - * the API specification. Also, it is pathological to have - * null borders anyway. - */ + // While it would be safe to assume true for the opacity of + // a null border, this behavior would not be according to + // the API specification. Also, it is pathological to have + // null borders anyway. if ((insideBorder == null) || (outsideBorder == null)) return false; return insideBorder.isBorderOpaque() && outsideBorder.isBorderOpaque(); } - /** * Paints the compound border by first painting the outside border, @@ -148,9 +140,9 @@ public void paintBorder(Component c, Graphics g, int x, int y, int width, int height) { - /* If there is an outside border, paint it and reduce the - * bounding box by its insets. - */ + // If there is an outside border, paint it and reduce the + // bounding box by its insets. + // if (outsideBorder != null) { Insets outsideInsets; @@ -161,9 +153,8 @@ x += outsideInsets.left; y += outsideInsets.top; - /* Reduce width and height by the respective extent of the - * outside border. - */ + // Reduce width and height by the respective extent of the + // outside border. width -= outsideInsets.left + outsideInsets.right; height -= outsideInsets.top + outsideInsets.bottom; } @@ -172,7 +163,6 @@ insideBorder.paintBorder(c, g, x, y, width, height); } - /** * Changes the specified insets to the insets of this border, * which is the sum of the insets of the inside and the outside @@ -192,7 +182,7 @@ else insets.left = insets.right = insets.top = insets.bottom = 0; - /* If there is an outside border, add it to insets. */ + // If there is an outside border, add it to insets. if (outsideBorder != null) { borderInsets = outsideBorder.getBorderInsets(c); @@ -202,7 +192,7 @@ insets.bottom += borderInsets.bottom; } - /* If there is an inside border, add it to insets. */ + // If there is an inside border, add it to insets. if (insideBorder != null) { borderInsets = insideBorder.getBorderInsets(c); @@ -215,35 +205,31 @@ return insets; } - /** * Determines the insets of this border, which is the sum of the * insets of the inside and the outside border. * * @param c the component in the center of this border. */ - public Insets getBorderInsets (Component c) + public Insets getBorderInsets(Component c) { - /* It is not clear why CompoundBorder does not simply inherit - * the implementation from AbstractBorder. However, we want - * to be compatible with the API specification, which overrides - * the getBorderInsets(Component) method. - */ + // It is not clear why CompoundBorder does not simply inherit + // the implementation from AbstractBorder. However, we want + // to be compatible with the API specification, which overrides + // the getBorderInsets(Component) method. return getBorderInsets (c, null); } - /** * Returns the outside border, which is painted outside both the * bordered Component and the inside border. It is valid for the * result to be <code>null</code>. */ - public Border getOutsideBorder () + public Border getOutsideBorder() { return outsideBorder; } - /** * Returns the inside border, which is painted between the bordered * Component and the outside border. It is valid for the result to @@ -254,4 +240,3 @@ return insideBorder; } } - Index: javax/swing/border/EmptyBorder.java =================================================================== RCS file: /cvsroot/classpath/classpath/javax/swing/border/EmptyBorder.java,v retrieving revision 1.7 diff -u -r1.7 EmptyBorder.java --- javax/swing/border/EmptyBorder.java 2 Jul 2005 20:32:49 -0000 1.7 +++ javax/swing/border/EmptyBorder.java 18 Oct 2005 20:19:15 -0000 @@ -53,8 +53,7 @@ * * @author Sascha Brawer ([EMAIL PROTECTED]) */ -public class EmptyBorder - extends AbstractBorder +public class EmptyBorder extends AbstractBorder { /** * Determined using the <code>serialver</code> tool @@ -142,6 +141,7 @@ public void paintBorder(Component c, Graphics g, int x, int y, int width, int height) { + // Nothing to do here. } Index: javax/swing/border/EtchedBorder.java =================================================================== RCS file: /cvsroot/classpath/classpath/javax/swing/border/EtchedBorder.java,v retrieving revision 1.8 diff -u -r1.8 EtchedBorder.java --- javax/swing/border/EtchedBorder.java 21 Jul 2005 16:11:10 -0000 1.8 +++ javax/swing/border/EtchedBorder.java 18 Oct 2005 20:19:15 -0000 @@ -56,8 +56,7 @@ * * @author Sascha Brawer ([EMAIL PROTECTED]) */ -public class EtchedBorder - extends AbstractBorder +public class EtchedBorder extends AbstractBorder { /** * Determined using the <code>serialver</code> tool @@ -199,8 +198,8 @@ * @param width the width of the available area for painting the border. * @param height the height of the available area for painting the border. */ - public void paintBorder(Component c, Graphics g, - int x, int y, int width, int height) + public void paintBorder(Component c, Graphics g, int x, int y, int width, + int height) { switch (etchType) { @@ -270,16 +269,14 @@ */ public boolean isBorderOpaque() { - /* If the colors are to be drived from the enclosed Component's - * background color, the border is guaranteed to be fully opaque - * because Color.brighten() and Color.darken() always return an - * opaque color. - */ + // If the colors are to be derived from the enclosed Component's + // background color, the border is guaranteed to be fully opaque + // because Color.brighten() and Color.darken() always return an + // opaque color. return ((highlight == null) || (highlight.getAlpha() == 255)) && ((shadow == null) || (shadow.getAlpha() == 255)); } - /** * Returns the appearance of this EtchedBorder, which is either @@ -310,8 +307,7 @@ else return c.getBackground().brighter(); } - - + /** * Returns the color that will be used for highlighted parts when * painting the border, or <code>null</code> if that color will be @@ -359,11 +355,11 @@ * Paints a two-pixel etching in two colors. * * <pre> - * @@@@@@@@@@@. - * @[EMAIL PROTECTED] @ = color a - * @. @. . = color b - * @. @. - * @@@@@@@@@@@. + * +++++++++++. + * +.........+. + = color a + * +. +. . = color b + * +. +. + * +++++++++++. * ............</pre> * * @param g the graphics for painting. @@ -374,9 +370,8 @@ * @param a one of the two colors. * @param b the second of the two colors. */ - private static void paintEtchedBorder(Graphics g, - int x, int y, int width, int height, - Color a, Color b) + private static void paintEtchedBorder(Graphics g, int x, int y, int width, + int height, Color a, Color b) { Color oldColor; @@ -387,11 +382,10 @@ try { - /* To understand this code, it might be helpful to look at the - * images that are included with the JavaDoc. They are located - * in the "doc-files" subdirectory. EtchedBorder-2.png might - * be especially informative. - */ + // To understand this code, it might be helpful to look at the + // images that are included with the JavaDoc. They are located + // in the "doc-files" subdirectory. EtchedBorder-2.png might + // be especially informative. g.setColor(a); g.drawRect(0, 0, width - 1, height - 1); @@ -408,4 +402,3 @@ } } } - Index: javax/swing/border/LineBorder.java =================================================================== RCS file: /cvsroot/classpath/classpath/javax/swing/border/LineBorder.java,v retrieving revision 1.9 diff -u -r1.9 LineBorder.java --- javax/swing/border/LineBorder.java 21 Jul 2005 16:11:10 -0000 1.9 +++ javax/swing/border/LineBorder.java 18 Oct 2005 20:19:15 -0000 @@ -50,8 +50,7 @@ * * @author Sascha Brawer ([EMAIL PROTECTED]) */ -public class LineBorder - extends AbstractBorder +public class LineBorder extends AbstractBorder { /** * Determined using the <code>serialver</code> tool @@ -71,7 +70,7 @@ /** * A shared instance of a gray, one pixel thick, plain LineBorder. * The singleton object is lazily created by [EMAIL PROTECTED] - * #createBlackGrayBorder()} upon its first invocation. + * #createGrayLineBorder()} upon its first invocation. */ private static LineBorder grayLineBorder; @@ -213,29 +212,27 @@ { g.setColor(lineColor); - /* If width and height were not adjusted, the border would - * appear one pixel too large in both directions. - */ + // If width and height were not adjusted, the border would + // appear one pixel too large in both directions. width -= 1; height -= 1; - /* Blurred, too large appearance - * ----------------------------- - * While Java 2D has introduced line strokes of arbitrary width, - * it seems desirable to keep this code independent of Java 2D. - * Therefore, multiple nested rectangles (or rounded rectangles) - * are drawn in order to simulate a line whose thickness is - * greater than one pixel. - * - * This hack causes a blurred appearance when anti-aliasing is - * on. Interestingly enough, though, the Sun JDK 1.3.1 (at least - * on MacOS X 10.1.5) shows exactly the same appearance under - * this condition. It thus seems likely that Sun does the same - * hack for simulating thick lines. For this reason, the - * blurred appearance seems acceptable -- especially since GNU - * Classpath tries to be compatible with the Sun reference - * implementation. - */ + // Blurred, too large appearance + // ----------------------------- + // While Java 2D has introduced line strokes of arbitrary width, + // it seems desirable to keep this code independent of Java 2D. + // Therefore, multiple nested rectangles (or rounded rectangles) + // are drawn in order to simulate a line whose thickness is + // greater than one pixel. + // + // This hack causes a blurred appearance when anti-aliasing is + // on. Interestingly enough, though, the Sun JDK 1.3.1 (at least + // on MacOS X 10.1.5) shows exactly the same appearance under + // this condition. It thus seems likely that Sun does the same + // hack for simulating thick lines. For this reason, the + // blurred appearance seems acceptable -- especially since GNU + // Classpath tries to be compatible with the Sun reference + // implementation. for (int i = 0; i < thickness; i++) { if (roundedCorners) @@ -340,4 +337,3 @@ return (!roundedCorners) && (lineColor.getAlpha() == 255); } } - Index: javax/swing/border/MatteBorder.java =================================================================== RCS file: /cvsroot/classpath/classpath/javax/swing/border/MatteBorder.java,v retrieving revision 1.9 diff -u -r1.9 MatteBorder.java --- javax/swing/border/MatteBorder.java 2 Jul 2005 20:32:49 -0000 1.9 +++ javax/swing/border/MatteBorder.java 18 Oct 2005 20:19:15 -0000 @@ -54,8 +54,7 @@ * * @author Sascha Brawer ([EMAIL PROTECTED]) */ -public class MatteBorder - extends EmptyBorder +public class MatteBorder extends EmptyBorder { /** * Determined using the <code>serialver</code> tool @@ -401,4 +400,3 @@ } } } - Index: javax/swing/border/SoftBevelBorder.java =================================================================== RCS file: /cvsroot/classpath/classpath/javax/swing/border/SoftBevelBorder.java,v retrieving revision 1.5 diff -u -r1.5 SoftBevelBorder.java --- javax/swing/border/SoftBevelBorder.java 21 Jul 2005 16:11:10 -0000 1.5 +++ javax/swing/border/SoftBevelBorder.java 18 Oct 2005 20:19:15 -0000 @@ -55,8 +55,7 @@ * * @author Sascha Brawer ([EMAIL PROTECTED]) */ -public class SoftBevelBorder - extends BevelBorder +public class SoftBevelBorder extends BevelBorder { /** * Determined using the <code>serialver</code> tool @@ -264,10 +263,10 @@ * Paints a soft bevel in four colors. * * <pre> - * @@@@@@@@@@@. - * @@.........# @ = color a - * @.. # . = color b - * @. # X = color c + * +++++++++++. + * ++.........# + = color a + * +.. # . = color b + * +. # X = color c * .. X# # = color d * . ##########</pre> * @@ -326,4 +325,3 @@ } } } - Index: javax/swing/border/TitledBorder.java =================================================================== RCS file: /cvsroot/classpath/classpath/javax/swing/border/TitledBorder.java,v retrieving revision 1.11 diff -u -r1.11 TitledBorder.java --- javax/swing/border/TitledBorder.java 10 Oct 2005 08:28:48 -0000 1.11 +++ javax/swing/border/TitledBorder.java 18 Oct 2005 20:19:15 -0000 @@ -58,8 +58,7 @@ * * @author Sascha Brawer ([EMAIL PROTECTED]) */ -public class TitledBorder - extends AbstractBorder +public class TitledBorder extends AbstractBorder { /** * A value for the <code>titlePosition</code> property that vertically
_______________________________________________ Classpath-patches mailing list Classpath-patches@gnu.org http://lists.gnu.org/mailman/listinfo/classpath-patches