borland Packages  Class Hierarchy  jbcl.control Package  Index 

ShapeControl component

java.lang.Object
   +----java.awt.Component
           +----java.awt.Container
                   +----com.sun.java.swing.JComponent
                           +----borland.jbcl.control.ShapeControl

About the ShapeControl component

Variables  Constructors  Properties  Methods  Event Listeners

Implements BlackBox, ImageObserver, MenuContainer, Serializable

Draws graphics shapes, such as rectangles with rounded corners. You can place ShapeControl objects on any container, such as a panel or canvas. When you drop a ShapeControl from the Component Palette onto the UI Designer, the shape defaults to a filled rectangle. You can then change the shape to any of the following with the type property:

Rectangle
Square
Round Rectangle
Round Square
Ellipse
Circle
Horizontal Line
Vertical Line
Positive Slope Line (bottom left to top right)
Negative Slope Line (top left to bottom right)

The edgeColor and drawEdge properties enable you to put a colored border on a shape. If the fill property is true, the shape is filled with the color specified as the value of the foreground property.

To paint the shape, call the paint() method.


ShapeControl variables

Variables implemented in this class

Variables implemented in com.sun.java.swing.JComponent

Variables implemented in java.awt.Component

ShapeControl constructors

ShapeControl properties

*Read-only properties **Write-only properties

Properties implemented in this class

Properties implemented in com.sun.java.swing.JComponent

Properties implemented in java.awt.Component

Properties implemented in java.awt.Container

Properties implemented in java.lang.Object

ShapeControl methods

Methods implemented in this class

Methods implemented in com.sun.java.swing.JComponent

Methods implemented in java.awt.Component

Methods implemented in java.awt.Container

Methods implemented in java.lang.Object

ShapeControl event listeners


ShapeControl variables

CIRCLE

  public static final int CIRCLE = 5

Indicates that the shape object is a circle.

ELLIPSE

  public static final int ELLIPSE = 4

Indicates that the shape object is an ellipse.

HORZ_LINE

  public static final int HORZ_LINE = 6

Indicates that the shape object is a horizontal line.

NEG_SLOPE_LINE

  public static final int NEG_SLOPE_LINE = 9

Indicates that the shape object is a line sloping from the upper left corner of the specified region to the lower right corner.

POS_SLOPE_LINE

  public static final int POS_SLOPE_LINE = 8

Indicates that the shape object is a line sloping from the lower left corner of the specified region to the upper right corner.

RECTANGLE

  public static final int RECTANGLE = 0

Indicates that the shape object is a rectangle.

ROUND_RECT

  public static final int ROUND_RECT = 1

Indicates that the shape object is a rectangle with rounded corners.

ROUND_SQUARE

  public static final int ROUND_SQUARE = 3

Indicates that the shape object is a square with rounded corners.

SQUARE

  public static final int SQUARE = 2

Indicates that the shape object is a square.

VERT_LINE

  public static final int VERT_LINE = 7

Indicates that the shape object is a vertical line.


ShapeControl constructors

ShapeControl()

  public ShapeControl()

Constructs a ShapeControl 100 pixels by 100 pixels, with a white foreground fill and a black edge.

ShapeControl(int)

  public ShapeControl(int type)

Constructs a ShapeControl of the specified type, such as circle or square. Like the default constructor, this constructor defaults to 100 pixels by 100 pixels, with a white foreground fill and a black edge.


ShapeControl properties

drawEdge

 public boolean isDrawEdge()
 public void setDrawEdge(boolean drawEdge)

The drawEdge property stores whether to show a colored edge marking the edge of the shape object.

edgeColor

 public Color getEdgeColor()
 public void setEdgeColor(java.awt.Color edgeColor)

The edgeColor property stores the color of the line that marks the edge of the shape object. By default, it is black.

fill

 public boolean isFill()
 public void setFill(boolean fill)

The fill property stores whether to fill the shape with a foreground color. If false, the shape is filled with the color of the container on which the shape object is placed.

foreground

 public void setForeground(java.awt.Color color)

The foreground property stores the foreground color of the shape object. This is the color used to fill the shape if the fill property is true.

minimumSize

 public Dimension getMinimumSize()

The minimumSize property stores the minimum size that you will allow a layout manager to use for this shape control.

preferredSize

 public Dimension getPreferredSize()

The preferredSize property stores the size that you would prefer that a layout manager use to display this shape control.

type

 public int getType()
 public void setType(int type)

The type property stores the type of shape, such as circle or square. The possible values are one of the ShapeControl variables.


ShapeControl methods

paintComponent(java.awt.Graphics)

  public void paintComponent(java.awt.Graphics g)
Paints or repaints the ShapeControl.

Parameters:

g
The Graphics object to paint on.

Overrides: com.sun.java.swing.JComponent.paintComponent(java.awt.Graphics)


ShapeControl event listeners

This component is a source for the following event sets. For information on the standard AWT event sets, see Standard Java events.

ancestor

 public void addAncestorListener(com.sun.java.swing.event.AncestorListener )
 public void removeAncestorListener(com.sun.java.swing.event.AncestorListener )

component

 public synchronized void addComponentListener(java.awt.event.ComponentListener )
 public synchronized void removeComponentListener(java.awt.event.ComponentListener )

container

 public synchronized void addContainerListener(java.awt.event.ContainerListener )
 public void removeContainerListener(java.awt.event.ContainerListener )

focus

 public synchronized void addFocusListener(java.awt.event.FocusListener )
 public synchronized void removeFocusListener(java.awt.event.FocusListener )

key

 public synchronized void addKeyListener(java.awt.event.KeyListener )
 public synchronized void removeKeyListener(java.awt.event.KeyListener )

mouse

 public synchronized void addMouseListener(java.awt.event.MouseListener )
 public synchronized void removeMouseListener(java.awt.event.MouseListener )

mouseMotion

 public synchronized void addMouseMotionListener(java.awt.event.MouseMotionListener )
 public synchronized void removeMouseMotionListener(java.awt.event.MouseMotionListener )

propertyChange

 public synchronized void addPropertyChangeListener(java.beans.PropertyChangeListener )
 public synchronized void removePropertyChangeListener(java.beans.PropertyChangeListener )

vetoableChange

 public synchronized void addVetoableChangeListener(java.beans.VetoableChangeListener )
 public synchronized void removeVetoableChangeListener(java.beans.VetoableChangeListener )