JClass DesktopViews 6.3.0 API
Documentation

com.klg.jclass.util.swing
Class JCBorder

java.lang.Object
  |
  +--com.klg.jclass.util.swing.JCBorder
Direct Known Subclasses:
HiGridBorder

public class JCBorder
extends Object

The class contains static methods to draw shadows around a specified area. The most useful methods contained here are the various draw() methods.

The key difference between this static class and the Swing border classes is the ability to draw borders anywhere, not just around the outside of a component.


Field Summary
static String[] border_strings
          String names of the border styles.
static int[] border_values
          Style value that corresponds to the list of String names.
static int CONTROL_IN
          Border drawn with MS-Windows style control shadows.
static int CONTROL_OUT
          Border drawn with MS-Windows style control shadows.
static int ETCHED_IN
          Border drawn with double line; border appears inset.
static int ETCHED_OUT
          Border drawn with double line; border appears raised.
static int FRAME_IN
          Border drawn with 1-pixel shadow-in at edge; border appears framed.
static int FRAME_OUT
          Border drawn with 1-pixel shadow-out at edge; border appears framed.
static int IN
          Border drawn appears inset.
static int NONE
          No border.
static int NUM_BORDER_STYLES
          Number of different border styles.
static int OUT
          Border drawn appears raised.
static int PLAIN
          Border drawn in foreground color.
 
Constructor Summary
JCBorder()
           
 
Method Summary
static Color brighter(Color color)
          Calculates the color even when it is saturated, for example, when it is black or white.
static Color darker(Color color)
          Calculates the color even when it is saturated, for example, when it is black or white.
static void draw(Graphics gc, int style, int size, int x, int y, int width, int height, Color bg, Color plain)
          Draws a border.
static void draw(Graphics gc, int style, int size, int x, int y, int width, int height, Color bright, Color dark, Color plain)
          Draws a border.
static void drawBottomLines(Graphics g, int size, int x, int y, int w, int h, Color color)
          Draws the bottom and right lines.
static void drawNormal(Graphics g, int size, int x, int y, int w, int h, Color top, Color bottom)
           
static void drawTopLines(Graphics g, int size, int x, int y, int w, int h, Color color)
          Draws the top and left lines.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

NONE

public static final int NONE
No border.

See Also:
Constant Field Values

ETCHED_IN

public static final int ETCHED_IN
Border drawn with double line; border appears inset.

See Also:
Constant Field Values

ETCHED_OUT

public static final int ETCHED_OUT
Border drawn with double line; border appears raised.

See Also:
Constant Field Values

IN

public static final int IN
Border drawn appears inset.

See Also:
Constant Field Values

OUT

public static final int OUT
Border drawn appears raised.

See Also:
Constant Field Values

PLAIN

public static final int PLAIN
Border drawn in foreground color.

See Also:
Constant Field Values

FRAME_IN

public static final int FRAME_IN
Border drawn with 1-pixel shadow-in at edge; border appears framed.

See Also:
Constant Field Values

FRAME_OUT

public static final int FRAME_OUT
Border drawn with 1-pixel shadow-out at edge; border appears framed.

See Also:
Constant Field Values

CONTROL_IN

public static final int CONTROL_IN
Border drawn with MS-Windows style control shadows.

See Also:
Constant Field Values

CONTROL_OUT

public static final int CONTROL_OUT
Border drawn with MS-Windows style control shadows.

See Also:
Constant Field Values

NUM_BORDER_STYLES

public static final int NUM_BORDER_STYLES
Number of different border styles.

See Also:
Constant Field Values

border_strings

public static final String[] border_strings
String names of the border styles.


border_values

public static final int[] border_values
Style value that corresponds to the list of String names.

See Also:
border_strings
Constructor Detail

JCBorder

public JCBorder()
Method Detail

drawTopLines

public static void drawTopLines(Graphics g,
                                int size,
                                int x,
                                int y,
                                int w,
                                int h,
                                Color color)
Draws the top and left lines.

Parameters:
g - The graphics context used to draw
size - The number of lines to draw
x - The x position to start drawing
y - The y position to start drawing
w - The width of the horizontal lines
h - The height of the vertical lines
color - The line color

drawBottomLines

public static void drawBottomLines(Graphics g,
                                   int size,
                                   int x,
                                   int y,
                                   int w,
                                   int h,
                                   Color color)
Draws the bottom and right lines.

Parameters:
g - The graphics context used to draw
size - The number of lines to draw
x - The x position to start drawing
y - The y position to start drawing
w - The width of the horizontal lines
h - The height of the vertical lines
color - The line color

drawNormal

public static void drawNormal(Graphics g,
                              int size,
                              int x,
                              int y,
                              int w,
                              int h,
                              Color top,
                              Color bottom)

brighter

public static Color brighter(Color color)
Calculates the color even when it is saturated, for example, when it is black or white.

Parameters:
color - The color to make brighter
Returns:
The brighter color

darker

public static Color darker(Color color)
Calculates the color even when it is saturated, for example, when it is black or white.

Parameters:
color - The color to make darker
Returns:
The darker color

draw

public static void draw(Graphics gc,
                        int style,
                        int size,
                        int x,
                        int y,
                        int width,
                        int height,
                        Color bg,
                        Color plain)
Draws a border.

Parameters:
gc - The graphics context used to draw
style - One of the following members:
  ETCHED_IN    double line; border appears inset
ETCHED_OUT double line; border appears raised
FRAME_IN 1-pixel shadow-in at edge; border appears framed
FRAME_OUT 1-pixel shadow-out at edge; border appears framed
IN border appears inset
OUT border appears raised
CONTROL_IN MS-Windows control shadows
CONTROL_OUT MS-Windows control shadows
PLAIN border drawn in foreground color
NONE no border drawn
size - the shadow thickness
x - The x position of the rectangle in which to draw
y - The y position of the rectangle in which to draw
width - The width of the rectangle in which to draw
height - The height of the rectangle in which to draw
bg - The background color
plain - The color used to draw the sides of PLAIN shadows

draw

public static void draw(Graphics gc,
                        int style,
                        int size,
                        int x,
                        int y,
                        int width,
                        int height,
                        Color bright,
                        Color dark,
                        Color plain)
Draws a border.

Parameters:
gc - The graphics context used to draw
style - One of the following members:
  ETCHED_IN    double line; border appears inset
ETCHED_OUT double line; border appears raised
FRAME_IN 1-pixel shadow-in at edge; border appears framed
FRAME_OUT 1-pixel shadow-out at edge; border appears framed
IN border appears inset
OUT border appears raised
CONTROL_IN MS-Windows control shadows
CONTROL_OUT MS-Windows control shadows
PLAIN border drawn in foreground color
NONE no border drawn
size - the shadow thickness
x - The x position of the rectangle in which to draw
y - The y position of the rectangle in which to draw
width - The width of the rectangle in which to draw
height - The height of the rectangle in which to draw
bright - Bright shadow color
dark - Dark shadow color
plain - The color used to draw the sides of PLAIN shadows

Copyright © 2004 Quest Software Inc..
All rights reserved.