jbcl.control Package
java.lang.Object +----java.awt.Component +----java.awt.Container +----javax.swing.JComponent +----com.borland.jbcl.control.ShapeControl
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:
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.
public static final int CIRCLE = 5
Indicates that the shape object is a circle.
public static final int ELLIPSE = 4
Indicates that the shape object is an ellipse.
public static final int HORZ_LINE = 6
Indicates that the shape object is a horizontal 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.
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.
public static final int RECTANGLE = 0
Indicates that the shape object is a rectangle.
public static final int ROUND_RECT = 1
Indicates that the shape object is a rectangle with rounded corners.
public static final int ROUND_SQUARE = 3
Indicates that the shape object is a square with rounded corners.
public static final int SQUARE = 2
Indicates that the shape object is a square.
public static final int VERT_LINE = 7
Indicates that the shape object is a vertical line.
public ShapeControl()
Constructs a ShapeControl
100 pixels by 100 pixels,
with a white foreground fill and a black edge.
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.
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.
public Color getEdgeColor() public void setEdgeColor(Color edgeColor)
The edgeColor
property stores the color of the line
that marks the edge of the shape object. By default, it is black.
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.
public void setForeground(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.
public Dimension getMinimumSize()
The minimumSize
property stores the minimum size that
you will allow a layout manager to use for this shape control.
public Dimension getPreferredSize()
The preferredSize
property stores the size that you
would prefer that a layout manager use to display this shape
control.
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.
public void paintComponent(Graphics g)Paints or repaints the
ShapeControl
.
Parameters:
g
Overrides: javax.swing.JComponent.paintComponent(java.awt.Graphics)
public void addAncestorListener(javax.swing.event.AncestorListener ) public void removeAncestorListener(javax.swing.event.AncestorListener )
public synchronized void addComponentListener(java.awt.event.ComponentListener ) public synchronized void removeComponentListener(java.awt.event.ComponentListener )
public synchronized void addContainerListener(java.awt.event.ContainerListener ) public synchronized void removeContainerListener(java.awt.event.ContainerListener )
public synchronized void addFocusListener(java.awt.event.FocusListener ) public synchronized void removeFocusListener(java.awt.event.FocusListener )
public synchronized void addInputMethodListener(java.awt.event.InputMethodListener ) public synchronized void removeInputMethodListener(java.awt.event.InputMethodListener )
public synchronized void addKeyListener(java.awt.event.KeyListener ) public synchronized void removeKeyListener(java.awt.event.KeyListener )
public synchronized void addMouseListener(java.awt.event.MouseListener ) public synchronized void removeMouseListener(java.awt.event.MouseListener )
public synchronized void addMouseMotionListener(java.awt.event.MouseMotionListener ) public synchronized void removeMouseMotionListener(java.awt.event.MouseMotionListener )
public synchronized void addPropertyChangeListener(java.beans.PropertyChangeListener ) public synchronized void removePropertyChangeListener(java.beans.PropertyChangeListener )
public synchronized void addVetoableChangeListener(java.beans.VetoableChangeListener ) public synchronized void removeVetoableChangeListener(java.beans.VetoableChangeListener )