AbstractBorder.java, [...]: New versions from Classpath.
2003-06-05 Michael Koch <konqueror@gmx.de> * 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
This commit is contained in:
parent
fe7f8a4ebd
commit
93152c2fd6
9 changed files with 264 additions and 34 deletions
|
@ -1,3 +1,15 @@
|
|||
2003-06-05 Michael Koch <konqueror@gmx.de>
|
||||
|
||||
* 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 <konqueror@gmx.de>
|
||||
|
||||
* java/awt/Button.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,
|
||||
|
|
|
@ -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 BevelBorder()
|
||||
{
|
||||
}
|
||||
|
||||
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 (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,
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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.*;
|
||||
|
||||
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;
|
||||
|
||||
|
|
|
@ -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,
|
||||
|
|
|
@ -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,
|
||||
|
|
|
@ -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,
|
||||
|
|
|
@ -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)
|
||||
|
|
Loading…
Add table
Reference in a new issue