public class Polyline extends AbstractPointListShape
PointList
as a series of line segments. A Polyline figure
should be positioned by manipulating its points, NOT by calling
Figure.setBounds(Rectangle)
.
A polyline's bounds will be calculated automatically based on its PointList. The bounds will be the smallest Rectangle large enough to render the line properly. Children should not be added to a Polyline and will not affect the bounds calculation.
Figure.FigureIterator, Figure.IdentitySearch
IFigure.NoInsets
bgColor, border, bounds, fgColor, flags, font, MAX_FLAG, maxSize, minSize, NO_MANAGER, prefSize, toolTip
MAX_DIMENSION, MIN_DIMENSION, NO_INSETS
Constructor and Description |
---|
Polyline() |
Modifier and Type | Method and Description |
---|---|
boolean |
containsPoint(int x,
int y)
Returns
true if the point (x, y) is contained
within this IFigure's bounds. |
protected void |
fillShape(Graphics g)
Null implementation for a line.
|
Rectangle |
getBounds()
Returns the smallest rectangle completely enclosing the figure.
|
boolean |
isOpaque()
Returns
true if this IFigure is opaque. |
protected void |
outlineShape(Graphics g)
Outlines this shape using the foreground color.
|
void |
primTranslate(int x,
int y)
Translates this Figure's bounds, without firing a move.
|
void |
removeAllPoints()
Erases the Polyline and removes all of its
Points . |
void |
repaint()
Repaints this IFigure.
|
void |
setLineWidth(int w)
Sets the line width to be used to outline the shape.
|
void |
setPoints(PointList points)
Sets the list of points to be used by this polyline connection.
|
void |
setTolerance(int tolerance)
Sets the tolerance
|
protected boolean |
shapeContainsPoint(int x,
int y)
Returns
true if the point (x, y) is contained
within this figure. |
addPoint, childrenContainsPoint, getEnd, getPoints, getStart, insertPoint, removePoint, setEnd, setEndpoints, setPoint, setStart
getAlpha, getAntialias, getLineAttributes, getLineCap, getLineDash, getLineDashOffset, getLineJoin, getLineMiterLimit, getLineStyle, getLineWidth, getLineWidthFloat, paintFigure, setAlpha, setAlpha, setAntialias, setAntialias, setFill, setFillXOR, setLineAttributes, setLineCap, setLineDash, setLineDashOffset, setLineJoin, setLineMiterLimit, setLineStyle, setLineWidthFloat, setOutline, setOutlineXOR, setXOR
add, add, add, add, addAncestorListener, addCoordinateListener, addFigureListener, addFocusListener, addKeyListener, addLayoutListener, addListener, addMouseListener, addMouseMotionListener, addNotify, addPropertyChangeListener, addPropertyChangeListener, containsPoint, erase, findDescendantAtExcluding, findFigureAt, findFigureAt, findFigureAt, findFigureAtExcluding, findMouseEventTargetAt, findMouseEventTargetInDescendantsAt, fireCoordinateSystemChanged, fireFigureMoved, fireMoved, firePropertyChange, firePropertyChange, firePropertyChange, getBackgroundColor, getBorder, getChildren, getClientArea, getClientArea, getClippingStrategy, getCursor, getFlag, getFont, getForegroundColor, getInsets, getLayoutManager, getListeners, getLocalBackgroundColor, getLocalFont, getLocalForegroundColor, getLocation, getMaximumSize, getMinimumSize, getMinimumSize, getParent, getPreferredSize, getPreferredSize, getSize, getToolTip, getUpdateManager, handleFocusGained, handleFocusLost, handleKeyPressed, handleKeyReleased, handleMouseDoubleClicked, handleMouseDragged, handleMouseEntered, handleMouseExited, handleMouseHover, handleMouseMoved, handleMousePressed, handleMouseReleased, hasFocus, internalGetEventDispatcher, intersects, invalidate, invalidateTree, isCoordinateSystem, isEnabled, isFocusTraversable, isMirrored, isMouseEventTarget, isRequestFocusEnabled, isShowing, isValid, isValidationRoot, isVisible, layout, paint, paintBorder, paintChildren, paintClientArea, remove, removeAll, removeAncestorListener, removeCoordinateListener, removeFigureListener, removeFocusListener, removeKeyListener, removeLayoutListener, removeListener, removeMouseListener, removeMouseMotionListener, removeNotify, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, requestFocus, revalidate, setBackgroundColor, setBorder, setBounds, setChildrenDirection, setChildrenEnabled, setChildrenOrientation, setClippingStrategy, setConstraint, setCursor, setEnabled, setFlag, setFocusTraversable, setFont, setForegroundColor, setLayoutManager, setLocation, setMaximumSize, setMinimumSize, setOpaque, setParent, setPreferredSize, setPreferredSize, setRequestFocusEnabled, setSize, setSize, setToolTip, setValid, setVisible, translate, translateFromParent, translateToAbsolute, translateToParent, translateToRelative, useLocalCoordinates, validate
public boolean containsPoint(int x, int y)
IFigure
true
if the point (x, y)
is contained
within this IFigure's bounds.containsPoint
in interface IFigure
containsPoint
in class AbstractPointListShape
x
- The X coordinatey
- The Y coordinatetrue
if the point (x,y) is contained in this
IFigure's boundsIFigure.containsPoint(int, int)
protected boolean shapeContainsPoint(int x, int y)
AbstractPointListShape
true
if the point (x, y)
is contained
within this figure.shapeContainsPoint
in class AbstractPointListShape
x
- The X coordinatey
- The Y coordinatetrue
if the point (x,y) is contained in this figureprotected void fillShape(Graphics g)
fillShape
in class Shape
g
- the graphics objectShape.fillShape(Graphics)
public Rectangle getBounds()
Figure
getBounds
in interface IFigure
getBounds
in class Figure
IFigure.getBounds()
public boolean isOpaque()
IFigure
true
if this IFigure is opaque.isOpaque
in interface IFigure
isOpaque
in class Figure
false
because Polyline's aren't filledIFigure.isOpaque()
protected void outlineShape(Graphics g)
Shape
outlineShape
in class Shape
g
- the graphics objectShape.outlineShape(Graphics)
public void primTranslate(int x, int y)
Figure
primTranslate
in class Figure
x
- The amount to translate horizontallyy
- The amount to translate verticallyFigure.primTranslate(int, int)
public void removeAllPoints()
Points
.removeAllPoints
in class AbstractPointListShape
public void setLineWidth(int w)
Shape
setLineWidth
in class Shape
w
- the new widthShape.setLineWidth(int)
public void setPoints(PointList points)
setPoints
in class AbstractPointListShape
points
- new set of pointspublic void setTolerance(int tolerance)
tolerance
- the new tolerance value of the PolylineCopyright (c) IBM Corp. and others 2000, 2011. All Rights Reserved.