diff options
author | Roman Kennke <roman@kennke.org> | 2005-10-18 20:23:00 +0000 |
---|---|---|
committer | Roman Kennke <roman@kennke.org> | 2005-10-18 20:23:00 +0000 |
commit | 66fa6ebfec277568fd77a24f0babd71f14ca5a7e (patch) | |
tree | 69fa607270d10abb3f561e521cfa2c15a2a9bacd | |
parent | 286c0317ac932d6499933d396cef040690cecd6a (diff) | |
download | classpath-66fa6ebfec277568fd77a24f0babd71f14ca5a7e.tar.gz |
2005-10-18 Roman Kennke <kennke@aicas.com>
* 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
-rw-r--r-- | ChangeLog | 15 | ||||
-rw-r--r-- | javax/swing/border/AbstractBorder.java | 46 | ||||
-rw-r--r-- | javax/swing/border/BevelBorder.java | 13 | ||||
-rw-r--r-- | javax/swing/border/Border.java | 6 | ||||
-rw-r--r-- | javax/swing/border/CompoundBorder.java | 57 | ||||
-rw-r--r-- | javax/swing/border/EmptyBorder.java | 4 | ||||
-rw-r--r-- | javax/swing/border/EtchedBorder.java | 45 | ||||
-rw-r--r-- | javax/swing/border/LineBorder.java | 44 | ||||
-rw-r--r-- | javax/swing/border/MatteBorder.java | 4 | ||||
-rw-r--r-- | javax/swing/border/SoftBevelBorder.java | 12 | ||||
-rw-r--r-- | javax/swing/border/TitledBorder.java | 3 |
11 files changed, 111 insertions, 138 deletions
@@ -1,3 +1,18 @@ +2005-10-18 Roman Kennke <kennke@aicas.com> + + * 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 + 2005-10-18 Lillian Angel <langel@redhat.com> * java/awt/GridBagLayout.java diff --git a/javax/swing/border/AbstractBorder.java b/javax/swing/border/AbstractBorder.java index 951debd52..7cbbcdaa8 100644 --- a/javax/swing/border/AbstractBorder.java +++ b/javax/swing/border/AbstractBorder.java @@ -52,20 +52,18 @@ import java.io.Serializable; * @author Sascha Brawer (brawer@dandelis.ch) * @author Ronald Veldema (rveldema@cs.vu.nl) */ -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 @@ public abstract class AbstractBorder * @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 @@ public abstract class AbstractBorder * * @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 @@ public abstract class AbstractBorder * * @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 @@ public abstract class AbstractBorder * @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 @@ public abstract class AbstractBorder * @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; diff --git a/javax/swing/border/BevelBorder.java b/javax/swing/border/BevelBorder.java index fcdc1c646..45b758cae 100644 --- a/javax/swing/border/BevelBorder.java +++ b/javax/swing/border/BevelBorder.java @@ -55,8 +55,7 @@ import java.awt.Insets; * * @author Sascha Brawer (brawer@dandelis.ch) */ -public class BevelBorder - extends AbstractBorder +public class BevelBorder extends AbstractBorder { /** * Determined using the <code>serialver</code> tool @@ -508,11 +507,11 @@ public class BevelBorder * 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. diff --git a/javax/swing/border/Border.java b/javax/swing/border/Border.java index 11bddfe78..f4af3fb38 100644 --- a/javax/swing/border/Border.java +++ b/javax/swing/border/Border.java @@ -77,9 +77,8 @@ public interface Border * @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. @@ -92,7 +91,6 @@ public interface Border */ Insets getBorderInsets(Component c); - /** * Determines whether this border fills every pixel in its area * when painting. diff --git a/javax/swing/border/CompoundBorder.java b/javax/swing/border/CompoundBorder.java index 2130a0e34..998a9bab3 100644 --- a/javax/swing/border/CompoundBorder.java +++ b/javax/swing/border/CompoundBorder.java @@ -48,8 +48,7 @@ import java.awt.Insets; * * @author Sascha Brawer (brawer@dandelis.ch) */ -public class CompoundBorder - extends AbstractBorder +public class CompoundBorder extends AbstractBorder { /** * Determined using the <code>serialver</code> tool @@ -57,7 +56,6 @@ public class CompoundBorder */ 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 @@ public class CompoundBorder */ 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 @@ public class CompoundBorder */ 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 @@ public class CompoundBorder * * @see EmptyBorder */ - public CompoundBorder () + public CompoundBorder() { this (null, null); } - /** * Constructs a CompoundBorder with the specified inside and * outside borders. @@ -103,13 +98,12 @@ public class CompoundBorder * 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 @@ public class CompoundBorder * @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 class CompoundBorder 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 @@ public class CompoundBorder 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 @@ public class CompoundBorder 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 @@ public class CompoundBorder 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 @@ public class CompoundBorder 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 @@ public class CompoundBorder 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 @@ public class CompoundBorder return insideBorder; } } - diff --git a/javax/swing/border/EmptyBorder.java b/javax/swing/border/EmptyBorder.java index 0f3b7b693..c8e9c6044 100644 --- a/javax/swing/border/EmptyBorder.java +++ b/javax/swing/border/EmptyBorder.java @@ -53,8 +53,7 @@ import java.awt.Insets; * * @author Sascha Brawer (brawer@dandelis.ch) */ -public class EmptyBorder - extends AbstractBorder +public class EmptyBorder extends AbstractBorder { /** * Determined using the <code>serialver</code> tool @@ -142,6 +141,7 @@ public class EmptyBorder public void paintBorder(Component c, Graphics g, int x, int y, int width, int height) { + // Nothing to do here. } diff --git a/javax/swing/border/EtchedBorder.java b/javax/swing/border/EtchedBorder.java index 0bd76ff0f..22882b78c 100644 --- a/javax/swing/border/EtchedBorder.java +++ b/javax/swing/border/EtchedBorder.java @@ -56,8 +56,7 @@ import java.awt.Insets; * * @author Sascha Brawer (brawer@dandelis.ch) */ -public class EtchedBorder - extends AbstractBorder +public class EtchedBorder extends AbstractBorder { /** * Determined using the <code>serialver</code> tool @@ -199,8 +198,8 @@ public class EtchedBorder * @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 class EtchedBorder */ 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 @@ public class EtchedBorder 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 @@ public class EtchedBorder * Paints a two-pixel etching in two colors. * * <pre> - * @@@@@@@@@@@. - * @.........@. @ = color a - * @. @. . = color b - * @. @. - * @@@@@@@@@@@. + * +++++++++++. + * +.........+. + = color a + * +. +. . = color b + * +. +. + * +++++++++++. * ............</pre> * * @param g the graphics for painting. @@ -374,9 +370,8 @@ public class EtchedBorder * @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 @@ public class EtchedBorder 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 @@ public class EtchedBorder } } } - diff --git a/javax/swing/border/LineBorder.java b/javax/swing/border/LineBorder.java index c34e38c57..36abddd91 100644 --- a/javax/swing/border/LineBorder.java +++ b/javax/swing/border/LineBorder.java @@ -50,8 +50,7 @@ import java.awt.Insets; * * @author Sascha Brawer (brawer@dandelis.ch) */ -public class LineBorder - extends AbstractBorder +public class LineBorder extends AbstractBorder { /** * Determined using the <code>serialver</code> tool @@ -71,7 +70,7 @@ public class LineBorder /** * A shared instance of a gray, one pixel thick, plain LineBorder. * The singleton object is lazily created by {@link - * #createBlackGrayBorder()} upon its first invocation. + * #createGrayLineBorder()} upon its first invocation. */ private static LineBorder grayLineBorder; @@ -213,29 +212,27 @@ public class LineBorder { 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 @@ public class LineBorder return (!roundedCorners) && (lineColor.getAlpha() == 255); } } - diff --git a/javax/swing/border/MatteBorder.java b/javax/swing/border/MatteBorder.java index f7ff1ca01..4d5b8c253 100644 --- a/javax/swing/border/MatteBorder.java +++ b/javax/swing/border/MatteBorder.java @@ -54,8 +54,7 @@ import javax.swing.Icon; * * @author Sascha Brawer (brawer@dandelis.ch) */ -public class MatteBorder - extends EmptyBorder +public class MatteBorder extends EmptyBorder { /** * Determined using the <code>serialver</code> tool @@ -401,4 +400,3 @@ public class MatteBorder } } } - diff --git a/javax/swing/border/SoftBevelBorder.java b/javax/swing/border/SoftBevelBorder.java index 379ecb65a..028fd00e0 100644 --- a/javax/swing/border/SoftBevelBorder.java +++ b/javax/swing/border/SoftBevelBorder.java @@ -55,8 +55,7 @@ import java.awt.Insets; * * @author Sascha Brawer (brawer@dandelis.ch) */ -public class SoftBevelBorder - extends BevelBorder +public class SoftBevelBorder extends BevelBorder { /** * Determined using the <code>serialver</code> tool @@ -264,10 +263,10 @@ public class SoftBevelBorder * 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 @@ public class SoftBevelBorder } } } - diff --git a/javax/swing/border/TitledBorder.java b/javax/swing/border/TitledBorder.java index 1c7068d02..8d3ee13d4 100644 --- a/javax/swing/border/TitledBorder.java +++ b/javax/swing/border/TitledBorder.java @@ -58,8 +58,7 @@ import javax.swing.UIManager; * * @author Sascha Brawer (brawer@dandelis.ch) */ -public class TitledBorder - extends AbstractBorder +public class TitledBorder extends AbstractBorder { /** * A value for the <code>titlePosition</code> property that vertically |