|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjavax.swing.border.AbstractBorder
org.peace_tools.generic.CustomBorder
public class CustomBorder
A custom border that draws 4 lines along the edges of a given component based on either color codes or four custom colors. Each side of the border can be independently controlled.
Field Summary | |
---|---|
(package private) java.lang.String |
colorCodes
Create a custom border using 4 character codes for top, left, bottom, right. |
(package private) java.awt.Color[] |
colors
An array of four colors corresponding to top, left, bottom, right borders |
private static long |
serialVersionUID
A generated serialization values. |
Constructor Summary | |
---|---|
CustomBorder(java.awt.Color top,
java.awt.Color left,
java.awt.Color bottom,
java.awt.Color right)
Create a custom border with a given set of colors. |
|
CustomBorder(java.lang.String colorCodes)
Create a custom border using 4 character codes for top, left, bottom, right. |
Method Summary | |
---|---|
java.awt.Insets |
getBorderInsets(java.awt.Component c)
Returns the insets of the border. |
java.awt.Insets |
getBorderInsets(java.awt.Component c,
java.awt.Insets insets)
Reinitialize the insets parameter with this Border's current Insets. |
protected java.awt.Color |
getColor(int i,
java.awt.Component c)
Helper method to get the color associated with a given side of the border. |
boolean |
isBorderOpaque()
Returns whether or not the border is opaque. |
void |
paintBorder(java.awt.Component comp,
java.awt.Graphics g,
int x,
int y,
int width,
int height)
Paints the border for the specified component with the specified position and size. |
Methods inherited from class javax.swing.border.AbstractBorder |
---|
getBaseline, getBaselineResizeBehavior, getInteriorRectangle, getInteriorRectangle |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
private static final long serialVersionUID
java.lang.String colorCodes
java.awt.Color[] colors
Constructor Detail |
---|
public CustomBorder(java.lang.String colorCodes)
colorCodes
- A string with 4 characters (example:
"ddll" indicating the border colors in the order top,
left, bottom, right.public CustomBorder(java.awt.Color top, java.awt.Color left, java.awt.Color bottom, java.awt.Color right)
top
- Color to be used for the top line.left
- Color to be used for the left line.bottom
- Color to be used for the bottom line.right
- Color to be used for the right line.Method Detail |
---|
public void paintBorder(java.awt.Component comp, java.awt.Graphics g, int x, int y, int width, int height)
paintBorder
in interface javax.swing.border.Border
paintBorder
in class javax.swing.border.AbstractBorder
comp
- the component for which this border is being paintedg
- the paint graphicsx
- the x position of the painted bordery
- the y position of the painted borderwidth
- the width of the painted borderheight
- the height of the painted borderpublic java.awt.Insets getBorderInsets(java.awt.Component c)
getBorderInsets
in interface javax.swing.border.Border
getBorderInsets
in class javax.swing.border.AbstractBorder
c
- the component for which this border insets value appliespublic java.awt.Insets getBorderInsets(java.awt.Component c, java.awt.Insets insets)
getBorderInsets
in class javax.swing.border.AbstractBorder
c
- the component for which this border insets value appliesinsets
- the object to be reinitializedpublic boolean isBorderOpaque()
isBorderOpaque
in interface javax.swing.border.Border
isBorderOpaque
in class javax.swing.border.AbstractBorder
protected java.awt.Color getColor(int i, java.awt.Component c)
i
- The index/direction of border.c
- The component from which colors are derived.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |