geofasc.swing
public class LineSegment extends AbstractFigure
LineSegment
is the component used for visualizing a line segment
figure. See LineSegmentModel
for more information on how a line
segment figure is represented. This class is inherited from
AbstractFigure
.DefaultLineSegmentModel
,
LineSegmentUI
,
BasicLineSegmentUI
,
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 |
---|
LineSegment()
Constructs a new empty
LineSegment with length 0 and at
(x,y)- location (0,0) . |
LineSegment(int x0,
int y0,
int x1,
int y1)
Constructs a new
LineSegment with the given restricting
points and at (x,y)- location (0,0) . |
LineSegment(int x,
int y,
int x0,
int y0,
int x1,
int y1)
Constructs a new
LineSegment with the given restricting
points and at the given location. |
LineSegment(int x,
int y,
Point firstPoint,
Point secondPoint)
Constructs a new
LineSegment with the given restricting
points and at the given location. |
LineSegment(Point firstPoint,
Point secondPoint)
Constructs a new
LineSegment with the given restricting
points and at (x,y)- location (0,0) . |
Modifier and Type | Method and Description |
---|---|
Point |
getFirstPoint()
|
int |
getFirstPointX()
|
int |
getFirstPointY()
|
int |
getLength()
|
LineSegmentModel |
getModel()
Returns the data model of this figure.
|
Point |
getSecondPoint()
|
int |
getSecondPointX()
|
int |
getSecondPointY()
|
LineSegmentUI |
getUI() |
String |
getUIClassID() |
void |
setFirstPoint(Point firstPoint)
|
void |
setFirstPointX(int x)
|
void |
setFirstPointY(int y)
|
void |
setModel(LineSegmentModel model)
Sets the model of this line segment.
|
void |
setSecondPoint(Point secondPoint)
|
void |
setSecondPointX(int x)
|
void |
setSecondPointY(int y)
|
void |
setUI(LineSegmentUI ui)
Sets the look and feel (L&F) object that renders this line segment.
|
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 LineSegment()
LineSegment
with length 0 and at
(x,y)-
location (0,0)
.public LineSegment(int x0, int y0, int x1, int y1)
LineSegment
with the given restricting
points and at (x,y)-
location (0,0)
. The
coordinates of the points refer to this components coordinate system. The
location refers to this component's parent coordinate system.x0
- the initial x-location of the first point of this line segmenty0
- the initial y-location of the first point of this line segmentx1
- the initial x-location of the second point of this line
segmenty1
- the initial y-location of the second point of this line
segmentpublic LineSegment(Point firstPoint, Point secondPoint)
LineSegment
with the given restricting
points and at (x,y)-
location (0,0)
. The
coordinates of the points refer to this components coordinate system. The
location refers to this component's parent coordinate system.firstPoint
- the first point of this line segmentsecondPoint
- the second point of this line segmentpublic LineSegment(int x, int y, int x0, int y0, int x1, int y1)
LineSegment
with the given restricting
points and at the given location. The coordinates of the points refer to
this components coordinate system. The location refers to this
component's parent coordinate system.x
- the x-location of this line segmenty
- the y-location of this line segmentx0
- the initial x-location of the first point of this line segmenty0
- the initial y-location of the first point of this line segmentx1
- the initial x-location of the second point of this line
segmenty1
- the initial y-location of the second point of this line
segmentpublic LineSegment(int x, int y, Point firstPoint, Point secondPoint)
LineSegment
with the given restricting
points and at the given location. The coordinates of the points refer to
this components coordinate system. The location refers to this
component's parent coordinate system.x
- the x-location of this line segmenty
- the y-location of this line segmentfirstPoint
- the first point of the line segmentsecondPoint
- the second point of the line segmentpublic LineSegmentModel getModel()
getModel
in class AbstractFigure
FigureModel
public void setModel(LineSegmentModel model)
model
- the new model of this line segmentpublic void setUI(LineSegmentUI ui)
ui
- the new L&F objectpublic void updateUI()
updateUI
in class AbstractFigure
public LineSegmentUI getUI()
getUI
in class AbstractFigure
public String getUIClassID()
getUIClassID
in class AbstractFigure
public Point getFirstPoint()
public int getFirstPointX()
public int getFirstPointY()
public int getLength()
public Point getSecondPoint()
public int getSecondPointX()
public int getSecondPointY()
public void setFirstPoint(Point firstPoint)
public void setFirstPointX(int x)
public void setFirstPointY(int y)
public void setSecondPoint(Point secondPoint)
public void setSecondPointX(int x)
public void setSecondPointY(int y)