geofasc.swing
public class Polyline extends AbstractFigure
Polyline
is the component used for visualizing a polyline or
polygon figure. The polyline is interpreted as a polygon if it is closed. See
PolylineModel
for more information on how a (closed) polyline figure
is represented. This class is inherited from AbstractFigure
.DefaultPolylineModel
,
PolylineUI
,
BasicPolylineUI
,
Serialized FormJComponent.AccessibleJComponent
Component.BaselineResizeBehavior
TOOL_TIP_TEXT_KEY, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOW
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
Constructor and Description |
---|
Polyline()
Constructs a new empty
Polyline with none points. |
Polyline(int[] xPoints,
int[] yPoints)
Constructs a new
Polyline with the given points at
(x,y)- location (0,0) . |
Polyline(int x,
int y,
int[] xPoints,
int[] yPoints)
Constructs a new
Polyline with the given points at the given
location. |
Polyline(int x,
int y,
Point... points)
Constructs a new
Polyline with the given points at the given
location. |
Polyline(Point... points)
Constructs a new
Polyline with the given points at
(x,y)- location (0,0) . |
Modifier and Type | Method and Description |
---|---|
boolean |
addPoint(int x,
int y)
|
boolean |
addPoint(int index,
int x,
int y)
|
boolean |
addPoint(int index,
Point point)
|
boolean |
addPoint(Point point)
|
int |
getIndexOfPoint(int x,
int y)
|
int |
getIndexOfPoint(Point point)
|
PolylineModel |
getModel()
Returns the data model of this figure.
|
int |
getNumberOfPoints()
|
Point |
getPoint(int index)
|
Point[] |
getPoints()
|
PolylineUI |
getUI() |
String |
getUIClassID() |
int[] |
getXPoints()
|
int[] |
getYPoints()
|
boolean |
isClosed()
|
boolean |
removePoint(int index)
|
boolean |
removePoint(int x,
int y)
|
boolean |
removePoint(Point point)
|
void |
setModel(PolylineModel model)
Sets the model of this polyline.
|
Point |
setPoint(int index,
int x,
int y)
|
Point |
setPoint(int index,
Point point)
|
boolean |
setPoints(Point[] points)
|
void |
setUI(PolylineUI ui) |
Polygon |
toAWTPolygon()
|
void |
updateUI() |
componentAdded, componentRemoved, getFigureBounds, getFigureBounds, getFigureDirection, getFigureFillColor, getFigureHeight, getFigureLineColor, getFigureLocation, getFigureLocationX, getFigureLocationY, getFigureSize, getFigureWidth, getMinimumSize, getPreferredSize, isFigureFilled, isSelfContainerListener, moveFigureLocationBy, moveFigureLocationBy, moveFigureLocationBy, moveFigureLocationXBy, moveFigureLocationYBy, setFigureDirection, setFigureFillColor, setFigureFilled, setFigureLineColor, setFigureLocation, setFigureLocation, setFigureLocationX, setFigureLocationY, setMaximumSize, setModel, setSelfContainerListener, setUI, stateChanged, turnFigureDirectionBy, turnFigureDirectionTo
getAccessibleContext, setUI
addAncestorListener, addNotify, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, firePropertyChange, firePropertyChange, firePropertyChange, getActionForKeyStroke, getActionMap, getAlignmentX, getAlignmentY, getAncestorListeners, getAutoscrolls, getBaseline, getBaselineResizeBehavior, getBorder, getBounds, getClientProperty, getComponentPopupMenu, getConditionForKeyStroke, getDebugGraphicsOptions, getDefaultLocale, getFontMetrics, getGraphics, getHeight, getInheritsPopupMenu, getInputMap, getInputMap, getInputVerifier, getInsets, getInsets, getListeners, getLocation, getMaximumSize, getNextFocusableComponent, getPopupLocation, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getToolTipText, getTopLevelAncestor, getTransferHandler, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, isDoubleBuffered, isLightweightComponent, isManagingFocus, isOpaque, isOptimizedDrawingEnabled, isPaintingForPrint, isPaintingTile, isRequestFocusEnabled, isValidateRoot, paint, paintImmediately, paintImmediately, print, printAll, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeNotify, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, requestFocus, requestFocus, requestFocusInWindow, resetKeyboardActions, reshape, revalidate, scrollRectToVisible, setActionMap, setAlignmentX, setAlignmentY, setAutoscrolls, setBackground, setBorder, setComponentPopupMenu, setDebugGraphicsOptions, setDefaultLocale, setDoubleBuffered, setEnabled, setFocusTraversalKeys, setFont, setForeground, setInheritsPopupMenu, setInputMap, setInputVerifier, setMinimumSize, setNextFocusableComponent, setOpaque, setPreferredSize, setRequestFocusEnabled, setToolTipText, setTransferHandler, setVerifyInputWhenFocusTarget, setVisible, unregisterKeyboardAction, update
add, add, add, add, add, addContainerListener, addPropertyChangeListener, addPropertyChangeListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalKeys, getFocusTraversalPolicy, getLayout, getMousePosition, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, printComponents, remove, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusCycleRoot, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setLayout, transferFocusDownCycle, validate
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, contains, createImage, createImage, createVolatileImage, createVolatileImage, dispatchEvent, enable, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBackground, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getForeground, getGraphicsConfiguration, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocale, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getToolkit, getTreeLock, gotFocus, handleEvent, hasFocus, hide, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isPreferredSizeSet, isShowing, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, postEvent, prepareImage, prepareImage, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, resize, resize, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setFocusable, setFocusTraversalKeysEnabled, setIgnoreRepaint, setLocale, setLocation, setLocation, setName, setSize, setSize, show, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCycle
public Polyline()
Polyline
with none points.public Polyline(int x, int y, int[] xPoints, int[] yPoints)
Polyline
with the given points at the given
location.x
- the initial x-location of this polyliney
- the initial y-location of this polylinexPoints
- the initial x-locations of all points of this polylineyPoints
- the initial y-locations of all points of this polylinepublic Polyline(int x, int y, Point... points)
Polyline
with the given points at the given
location.x
- the initial x-location of this polyliney
- the initial y-location of this polylinepoints
- the inital points of this polylinepublic Polyline(int[] xPoints, int[] yPoints)
Polyline
with the given points at
(x,y)-
location (0,0)
.xPoints
- the initial x-locations of all points of this polylineyPoints
- the initial y-locations of all points of this polylinepublic Polyline(Point... points)
Polyline
with the given points at
(x,y)-
location (0,0)
.points
- the inital points of this polylinepublic PolylineModel getModel()
getModel
in class AbstractFigure
FigureModel
public PolylineUI getUI()
getUI
in class AbstractFigure
public String getUIClassID()
getUIClassID
in class AbstractFigure
public void setModel(PolylineModel model)
model
- the new modelpublic void setUI(PolylineUI ui)
public void updateUI()
updateUI
in class AbstractFigure
public boolean addPoint(int x, int y)
public boolean addPoint(int index, int x, int y)
public boolean addPoint(Point point)
public boolean addPoint(int index, Point point)
public int getIndexOfPoint(int x, int y)
public int getIndexOfPoint(Point point)
public int getNumberOfPoints()
public Point getPoint(int index)
public Point[] getPoints()
public int[] getXPoints()
public int[] getYPoints()
public boolean isClosed()
public boolean removePoint(int index)
public boolean removePoint(int x, int y)
public boolean removePoint(Point point)
public Point setPoint(int index, int x, int y)
public boolean setPoints(Point[] points)
public Polygon toAWTPolygon()