public class ScalablePolygonShape extends AbstractPointListShape
PointList
as a polygonal shape
scaled in accordance with bounds to fill whole figure. This class is similar
to PolygonShape
, except the polygon should be scaled
expanded/compressed to fit in current bounds.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 |
---|
ScalablePolygonShape() |
Modifier and Type | Method and Description |
---|---|
void |
addPoint(Point pt)
Adds the passed point to this figure.
|
protected void |
fillShape(Graphics graphics)
Fills the interior of the shape with the background color.
|
PointList |
getScaledPoints() |
void |
insertPoint(Point pt,
int index)
Inserts a given point at a specified index in this figure.
|
protected void |
outlineShape(Graphics graphics)
Outlines this shape using the foreground color.
|
void |
removeAllPoints()
Erases this figure and removes all of its
Points . |
void |
removePoint(int index)
Removes a point from this figure.
|
void |
setBounds(Rectangle rect)
Sets the bounds of this Figure to the Rectangle rect.
|
void |
setEnd(Point end)
Sets the end point of this figure
|
void |
setLineWidth(int w)
Sets the line width to be used to outline the shape.
|
void |
setPoint(Point pt,
int index)
Sets the point at
index to the Point pt . |
void |
setPoints(PointList points)
Sets the list of points to be used by this figure.
|
void |
setStart(Point start)
Sets the start point of this figure
|
protected boolean |
shapeContainsPoint(int x,
int y)
Returns
true if the point (x, y) is contained
within this figure. |
childrenContainsPoint, containsPoint, getEnd, getPoints, getStart, setEndpoints
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, getBounds, 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, isOpaque, isRequestFocusEnabled, isShowing, isValid, isValidationRoot, isVisible, layout, paint, paintBorder, paintChildren, paintClientArea, primTranslate, remove, removeAll, removeAncestorListener, removeCoordinateListener, removeFigureListener, removeFocusListener, removeKeyListener, removeLayoutListener, removeListener, removeMouseListener, removeMouseMotionListener, removeNotify, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, requestFocus, revalidate, setBackgroundColor, setBorder, 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
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 graphics)
Shape
protected void outlineShape(Graphics graphics)
Shape
outlineShape
in class Shape
graphics
- the graphics objectpublic PointList getScaledPoints()
public void addPoint(Point pt)
AbstractPointListShape
addPoint
in class AbstractPointListShape
pt
- the Point to be added to this figurepublic void insertPoint(Point pt, int index)
AbstractPointListShape
insertPoint
in class AbstractPointListShape
pt
- the point to be addedindex
- the position in this figure where the point is to be addedpublic void removeAllPoints()
AbstractPointListShape
Points
.removeAllPoints
in class AbstractPointListShape
public void removePoint(int index)
AbstractPointListShape
removePoint
in class AbstractPointListShape
index
- the position of the point to be removedpublic void setStart(Point start)
AbstractPointListShape
setStart
in class AbstractPointListShape
start
- the point that will become the first point in this figurepublic void setEnd(Point end)
AbstractPointListShape
setEnd
in class AbstractPointListShape
end
- the point that will become the last point in this figurepublic void setPoint(Point pt, int index)
AbstractPointListShape
index
to the Point pt
. If
you're going to set multiple Points, use AbstractPointListShape.setPoints(PointList)
.setPoint
in class AbstractPointListShape
pt
- the pointindex
- the indexpublic void setPoints(PointList points)
AbstractPointListShape
setPoints
in class AbstractPointListShape
points
- new set of pointspublic void setBounds(Rectangle rect)
Figure
Figure.getBounds()
may return the current bounds by reference, it is
not safe to modify that Rectangle and then call setBounds() after making
modifications. The figure would assume that the bounds are unchanged, and
no layout or paint would occur. For proper behavior, always use a copy.public void setLineWidth(int w)
Shape
setLineWidth
in class Shape
w
- the new widthCopyright (c) IBM Corp. and others 2000, 2011. All Rights Reserved.