From: Michael Koch Date: Thu, 5 Jun 2003 19:59:44 +0000 (+0000) Subject: AbstractBorder.java, [...]: New versions from Classpath. X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=93152c2fd6a45f978c3dddd766d728ba267fcd07;p=gcc.git AbstractBorder.java, [...]: New versions from Classpath. 2003-06-05 Michael Koch * javax/swing/border/AbstractBorder.java, javax/swing/border/BevelBorder.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/TitledBorder.java: New versions from Classpath. From-SVN: r67507 --- diff --git a/libjava/ChangeLog b/libjava/ChangeLog index 5b8e96e277f..52c77620431 100644 --- a/libjava/ChangeLog +++ b/libjava/ChangeLog @@ -1,3 +1,15 @@ +2003-06-05 Michael Koch + + * javax/swing/border/AbstractBorder.java, + javax/swing/border/BevelBorder.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/TitledBorder.java: + New versions from Classpath. + 2003-06-05 Michael Koch * java/awt/Button.java, diff --git a/libjava/javax/swing/border/AbstractBorder.java b/libjava/javax/swing/border/AbstractBorder.java index d0285b33a5c..fad3aa288ef 100644 --- a/libjava/javax/swing/border/AbstractBorder.java +++ b/libjava/javax/swing/border/AbstractBorder.java @@ -35,18 +35,22 @@ this exception to your version of the library, but you are not obligated to do so. If you do not wish to do so, delete this exception statement from your version. */ + package javax.swing.border; -import java.io.*; -import java.awt.*; +import java.awt.Component; +import java.awt.Graphics; +import java.awt.Insets; +import java.awt.Rectangle; +import java.io.Serializable; public abstract class AbstractBorder implements Border, Serializable { static final long serialVersionUID = -545885975315191844L; - AbstractBorder() - { - } + public AbstractBorder () + { + } public void paintBorder(Component c, Graphics g, diff --git a/libjava/javax/swing/border/BevelBorder.java b/libjava/javax/swing/border/BevelBorder.java index ef2c279fa71..44da5b4e163 100644 --- a/libjava/javax/swing/border/BevelBorder.java +++ b/libjava/javax/swing/border/BevelBorder.java @@ -37,17 +37,42 @@ exception statement from your version. */ package javax.swing.border; -import java.awt.*; +import java.awt.Color; +import java.awt.Component; +import java.awt.Graphics; -public class BevelBorder extends EmptyBorder +public class BevelBorder extends AbstractBorder { - Color c; + public static final int LOWERED = 1; + public static final int RAISED = 0; + + protected int bevelType; + protected Color highlightOuter; + protected Color highlightInner; + protected Color shadowOuter; + protected Color shadowInner; - public BevelBorder() - { - } + public BevelBorder (int bevelType) + { + this (bevelType, null, null, null, null); + } + + public BevelBorder(int bevelType, Color highlight, Color shadow) + { + this (bevelType, highlight, highlight, shadow, shadow); + } + + public BevelBorder (int bevelType, Color highlightOuter, + Color highlightInner, Color shadowOuter, + Color shadowInner) + { + this.bevelType = bevelType; + this.highlightOuter = highlightOuter; + this.highlightInner = highlightInner; + this.shadowOuter = shadowOuter; + this.shadowInner = shadowInner; + } - public BevelBorder(int top, int left, int bottom, diff --git a/libjava/javax/swing/border/CompoundBorder.java b/libjava/javax/swing/border/CompoundBorder.java index a1e731e17cf..bf6a8caaefe 100644 --- a/libjava/javax/swing/border/CompoundBorder.java +++ b/libjava/javax/swing/border/CompoundBorder.java @@ -35,12 +35,28 @@ this exception to your version of the library, but you are not obligated to do so. If you do not wish to do so, delete this exception statement from your version. */ + package javax.swing.border; -import java.awt.*; +import java.awt.Component; +import java.awt.Graphics; +import java.awt.Insets; public class CompoundBorder extends AbstractBorder { + protected Border insideBorder; + protected Border outsideBorder; + + public CompoundBorder () + { + this (null, null); + } + + public CompoundBorder (Border outsideBorder, Border insideBorder) + { + this.outsideBorder = outsideBorder; + this.insideBorder = insideBorder; + } public Insets getBorderInsets(Component c, Insets s) diff --git a/libjava/javax/swing/border/EmptyBorder.java b/libjava/javax/swing/border/EmptyBorder.java index c09a0affc40..679c56fcae0 100644 --- a/libjava/javax/swing/border/EmptyBorder.java +++ b/libjava/javax/swing/border/EmptyBorder.java @@ -35,13 +35,33 @@ this exception to your version of the library, but you are not obligated to do so. If you do not wish to do so, delete this exception statement from your version. */ -package javax.swing.border; -import java.awt.*; +package javax.swing.border; +import java.awt.Component; +import java.awt.Graphics; +import java.awt.Insets; public class EmptyBorder extends AbstractBorder { + protected int left; + protected int right; + protected int bottom; + protected int top; + + public EmptyBorder (Insets borderInsets) + { + this (borderInsets.left, borderInsets.right, + borderInsets.top, borderInsets.bottom); + } + + public EmptyBorder (int left, int right, int top, int bottom) + { + this.left = left; + this.right = right; + this.top = top; + this.bottom = bottom; + } protected int l,r,b,t; diff --git a/libjava/javax/swing/border/EtchedBorder.java b/libjava/javax/swing/border/EtchedBorder.java index 97e5099d1a4..33c5073b182 100644 --- a/libjava/javax/swing/border/EtchedBorder.java +++ b/libjava/javax/swing/border/EtchedBorder.java @@ -35,18 +35,43 @@ this exception to your version of the library, but you are not obligated to do so. If you do not wish to do so, delete this exception statement from your version. */ + package javax.swing.border; -import java.awt.*; +import java.awt.Color; +import java.awt.Component; +import java.awt.Graphics; -public class EtchedBorder extends EmptyBorder +public class EtchedBorder extends AbstractBorder { - Color c; + public static final int LOWERED = 1; + public static final int RAISED = 0; + + protected int etchType; + protected Color highlight; + protected Color shadow; - public EtchedBorder() - { - } + public EtchedBorder () + { + this (LOWERED, null, null); + } + + public EtchedBorder (Color highlight, Color shadow) + { + this (LOWERED, highlight, shadow); + } + + public EtchedBorder (int etchType) + { + this (etchType, null, null); + } + public EtchedBorder (int etchType, Color highlight, Color shadow) + { + this.etchType = etchType; + this.highlight = highlight; + this.shadow = shadow; + } public EtchedBorder(int top, int left, diff --git a/libjava/javax/swing/border/LineBorder.java b/libjava/javax/swing/border/LineBorder.java index 7f3c6511668..ba6c060810e 100644 --- a/libjava/javax/swing/border/LineBorder.java +++ b/libjava/javax/swing/border/LineBorder.java @@ -35,18 +35,38 @@ this exception to your version of the library, but you are not obligated to do so. If you do not wish to do so, delete this exception statement from your version. */ + package javax.swing.border; -import java.awt.*; +import java.awt.Color; +import java.awt.Component; +import java.awt.Graphics; -public class LineBorder extends EmptyBorder +public class LineBorder extends AbstractBorder { - Color c; + protected Color lineColor; + protected boolean roundedCorners; + protected int thickness; - public LineBorder() - { - } + public LineBorder (Color color) + { + this (color, 1); + } + + public LineBorder (Color color, int thickness) + { + this (color, thickness, false); // FIXME: check roundedCorners argument + } + /** + * @since 1.3 + */ + public LineBorder (Color color, int thickness, boolean roundedCorners) + { + this.lineColor = color; + this.thickness = thickness; + this.roundedCorners = roundedCorners; + } public LineBorder(int top, int left, diff --git a/libjava/javax/swing/border/MatteBorder.java b/libjava/javax/swing/border/MatteBorder.java index 30e5f59e14e..9f1ed938a30 100644 --- a/libjava/javax/swing/border/MatteBorder.java +++ b/libjava/javax/swing/border/MatteBorder.java @@ -35,18 +35,49 @@ this exception to your version of the library, but you are not obligated to do so. If you do not wish to do so, delete this exception statement from your version. */ + package javax.swing.border; -import java.awt.*; +import java.awt.Color; +import java.awt.Component; +import java.awt.Graphics; +import java.awt.Insets; +import javax.swing.Icon; public class MatteBorder extends EmptyBorder { - Color c; + protected Color color; + protected Icon tileIcon; - public MatteBorder() - { - } + public MatteBorder (Icon tileIcon) + { + // FIXME: implement this + this (null, tileIcon); + } + + public MatteBorder (Insets borderInsets, Color color) + { + this (borderInsets.top, borderInsets.left, borderInsets.bottom, + borderInsets.right, color); + } + + public MatteBorder (Insets borderInsets, Icon tileIcon) + { + this (borderInsets.top, borderInsets.left, borderInsets.bottom, + borderInsets.right, tileIcon); + } + + public MatteBorder (int top, int left, int bottom, int right, Icon tileIcon) + { + super (top, left, bottom, right); + this.tileIcon = tileIcon; + } + public MatteBorder (int top, int left, int bottom, int right, Color color) + { + super (top, left, bottom, right); + this.color = color; + } public MatteBorder(int top, int left, diff --git a/libjava/javax/swing/border/TitledBorder.java b/libjava/javax/swing/border/TitledBorder.java index 5937aa4c0ad..8a16c1a0b79 100644 --- a/libjava/javax/swing/border/TitledBorder.java +++ b/libjava/javax/swing/border/TitledBorder.java @@ -35,12 +35,89 @@ this exception to your version of the library, but you are not obligated to do so. If you do not wish to do so, delete this exception statement from your version. */ + package javax.swing.border; -import java.awt.*; +import java.awt.Color; +import java.awt.Component; +import java.awt.Dimension; +import java.awt.Font; +import java.awt.Graphics; +import java.awt.Insets; public class TitledBorder extends AbstractBorder { + public static final int ABOVE_BOTTOM = 4; + public static final int ABOVE_TOP = 1; + public static final int BELOW_BOTTOM = 6; + public static final int BELOW_TOP = 3; + public static final int BOTTOM = 5; + public static final int CENTER = 2; + public static final int DEFAULT_JUSTIFICATION = 0; + public static final int DEFAULT_POSITION = 0; + public static final int LEADING = 4; + public static final int LEFT = 1; + public static final int RIGHT = 3; + public static final int TOP = 2; + public static final int TRAILING = 5; + + protected static final int EDGE_SPACING = 2; + protected static final int TEXT_INSET_H = 5; + protected static final int TEXT_SPACING = 2; + + protected Border border; + protected String title; + protected Color titleColor; + protected Font titleFont; + protected int titleJustification; + protected int titlePosition; + + private static Border defaultBorder = new BorderUIRessource (); + private static Font defaultFont = new FontUIRessource ("Dialog", BOLD, 12); + private static Color defaultColor = new ColorUIRessource (Color.black); + + public TitledBorder (String title) + { + this (defaultBorder, title, DEFAULT_JUSTIFICATION, DEFAULT_POSITION, + defaultFont, defaultColor); + } + + public TitledBorder (Border border) + { + this (border, "", DEFAULT_JUSTIFICATION, DEFAULT_POSITION, defaultFont, + defaultColor); + } + + public TitledBorder (Border border, String title) + { + this (border, title, DEFAULT_JUSTIFICATION, DEFAULT_POSITION, defaultFont, + defaultColor); + } + + public TitledBorder (Border border, String title, int titleJustification, + int titlePosition) + { + this (border, title, titleJustification, titlePosition, defaultFont, + defaultColor); + } + + public TitledBorder (Border border, String title, int titleJustification, + int titlePosition, Font titleFont) + { + this (border, title, titleJustification, titlePosition, titleFont, + defaultColor); + } + + public TitledBorder (Border border, String title, int titleJustification, + int titlePosition, Font titleFont, Color titleColor) + { + this.border = border; + this.title = title; + this.titleJustification = titleJustification; + this.titlePosition = titlePosition; + this.titleFont = titleFont; + this.titleColor = titleColor; + } public Insets getBorderInsets(Component c, Insets s)