Draw2d
3.9.0.201305060205

org.eclipse.draw2d
Class LineBorder

java.lang.Object
  extended by org.eclipse.draw2d.AbstractBorder
      extended by org.eclipse.draw2d.LineBorder
All Implemented Interfaces:
Border

public class LineBorder
extends AbstractBorder

Provides for a line border with sides of equal widths.


Field Summary
 
Fields inherited from class org.eclipse.draw2d.AbstractBorder
tempRect
 
Constructor Summary
LineBorder()
          Constructs a default black LineBorder with a width of one pixel.
LineBorder(Color color)
          Constructs a LineBorder with the specified color and a width of 1 pixel.
LineBorder(Color color, int width)
          Constructs a LineBorder with the specified color and of the specified width.
LineBorder(Color color, int width, int style)
          Constructs a LineBorder with the specified color and of the specified width and style.
LineBorder(int width)
          Constructs a black LineBorder with the specified width.
 
Method Summary
 Color getColor()
          Returns the line color of this border.
 Insets getInsets(IFigure figure)
          Returns the space used by the border for the figure provided as input.
 int getStyle()
          Returns the line style for this border.
 int getWidth()
          Returns the line width of this border.
 boolean isOpaque()
          Returns true since this border is opaque.
 void paint(IFigure figure, Graphics graphics, Insets insets)
          Paints the border.
 void setColor(Color color)
          Sets the line color for this border.
 void setStyle(int style)
          Sets the line type of this border.
 void setWidth(int width)
          Sets the line width for this border.
 
Methods inherited from class org.eclipse.draw2d.AbstractBorder
getPaintRectangle, getPreferredSize
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

LineBorder

public LineBorder(Color color,
                  int width,
                  int style)
Constructs a LineBorder with the specified color and of the specified width and style.

Parameters:
color - The color of the border.
width - The width of the border in pixels.
style - The style of the border. For the list of valid values, see Graphics
Since:
3.5

LineBorder

public LineBorder(Color color,
                  int width)
Constructs a LineBorder with the specified color and of the specified width.

Parameters:
color - The color of the border.
width - The width of the border in pixels.
Since:
2.0

LineBorder

public LineBorder(Color color)
Constructs a LineBorder with the specified color and a width of 1 pixel.

Parameters:
color - The color of the border.
Since:
2.0

LineBorder

public LineBorder(int width)
Constructs a black LineBorder with the specified width.

Parameters:
width - The width of the border in pixels.
Since:
2.0

LineBorder

public LineBorder()
Constructs a default black LineBorder with a width of one pixel.

Since:
2.0
Method Detail

getColor

public Color getColor()
Returns the line color of this border.

Returns:
The line color of this border

getInsets

public Insets getInsets(IFigure figure)
Returns the space used by the border for the figure provided as input. In this border all sides always have equal width.

Parameters:
figure - The figure this border belongs to
Returns:
This border's insets

getWidth

public int getWidth()
Returns the line width of this border.

Returns:
The line width of this border

isOpaque

public boolean isOpaque()
Returns true since this border is opaque. Being opaque it is responsible to fill in the area within its boundaries.

Specified by:
isOpaque in interface Border
Overrides:
isOpaque in class AbstractBorder
Returns:
true since this border is opaque
See Also:
Border.isOpaque()

paint

public void paint(IFigure figure,
                  Graphics graphics,
                  Insets insets)
Description copied from interface: Border
Paints the border. The border should paint inside figure's IFigure.getBounds(), inset by the parameter insets. The border generally should not paint inside its own insets. More specifically, Border b should paint inside the rectangle: figure.getBounds().getCropped(insets) and outside of the rectangle: figure.getBounds().getCropped(insets).getCropped(getInsets()) where inside is defined as Rectangle.contains(int, int).

Parameters:
figure - The figure this border belongs to
graphics - The graphics object used for painting
insets - The insets
See Also:
Border.paint(IFigure, Graphics, Insets)

setColor

public void setColor(Color color)
Sets the line color for this border.

Parameters:
color - The line color

setWidth

public void setWidth(int width)
Sets the line width for this border.

Parameters:
width - The line width

getStyle

public int getStyle()
Returns the line style for this border.

Returns:
The line style for this border
Since:
3.5

setStyle

public void setStyle(int style)
Sets the line type of this border.

Parameters:
style - For the list of valid values, see Graphics
Since:
3.5

Draw2d
3.9.0.201305060205

Copyright (c) IBM Corp. and others 2000, 2011. All Rights Reserved.