|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object java.awt.Component java.awt.Container javax.swing.JComponent javax.swing.JPanel yops.Graphic yops.Line
public class Line
A Line is a visual display of a line segment defined by the coordinates of two pixels at its end points.
Nested Class Summary |
---|
Nested classes/interfaces inherited from class javax.swing.JPanel |
---|
JPanel.AccessibleJPanel |
Nested classes/interfaces inherited from class javax.swing.JComponent |
---|
JComponent.AccessibleJComponent |
Nested classes/interfaces inherited from class java.awt.Container |
---|
Container.AccessibleAWTContainer |
Nested classes/interfaces inherited from class java.awt.Component |
---|
Component.AccessibleAWTComponent, Component.BltBufferStrategy, Component.FlipBufferStrategy |
Field Summary |
---|
Fields inherited from class yops.Graphic |
---|
THICK_STROKE |
Fields inherited from class javax.swing.JComponent |
---|
accessibleContext, listenerList, TOOL_TIP_TEXT_KEY, ui, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOW |
Fields inherited from class java.awt.Component |
---|
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT |
Fields inherited from interface java.awt.image.ImageObserver |
---|
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH |
Constructor Summary | |
---|---|
Line(int x1,
int y1,
int x2,
int y2)
Creates a Line with the given end points. |
Method Summary | |
---|---|
boolean |
contains(int x,
int y)
This contains method reports true if the given point is on, or very near, the line segment. |
boolean |
isFilled()
I If a Graphic is filled, it will be painted in a solid color. |
void |
paint(Graphics g)
Paints the Line when requested by the Java's graphics system. |
void |
setCenter(int x,
int y)
Sets the location of this Graphic so that its center is at the given pixel coordinates within its container. |
void |
setCorners(int x1,
int y1,
int x2,
int y2)
Changes the endpoints of the line, as well as the bounding box of the graphic based on any two diagonally opposite corners. |
void |
setFilled(boolean filled)
Sets whether or not the graphic should be filled (painted in a solid color). |
void |
setSize(int x,
int y)
|
void |
setUpperLeft(int x,
int y)
Sets the location of this Graphic so that its upper left corner is at the given pixel coordinates within its container. |
String |
toString()
Returns a String representation of the Line, including the coordinates of its end points. |
Methods inherited from class yops.Graphic |
---|
add, setFillColor, setLineColor |
Methods inherited from class javax.swing.JPanel |
---|
getAccessibleContext, getUI, getUIClassID, paramString, setUI, updateUI |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public Line(int x1, int y1, int x2, int y2)
x1
- the x coordinate of the first end pointy1
- the y coordinate of the first end pointx2
- the x coordinate of the second end pointy2
- the y coordinate of the second end pointMethod Detail |
---|
public boolean isFilled()
Graphic
isFilled
in class Graphic
public void setFilled(boolean filled)
Graphic
setFilled
in class Graphic
filled
- whether or not the Graphic should be filledpublic void setCorners(int x1, int y1, int x2, int y2)
x1
- the x coordinate of the first pointy1
- the y coordinate of the first pointx2
- the x coordinate of the second pointy2
- the y coordinate of the second pointpublic void setSize(int x, int y)
setSize
in class Component
public void setCenter(int x, int y)
Graphic
setCenter
in class Graphic
x
- in pixelsy
- in pixelspublic void setUpperLeft(int x, int y)
Graphic
setUpperLeft
in class Graphic
x
- in pixelsy
- in pixelspublic boolean contains(int x, int y)
contains
in class JComponent
public void paint(Graphics g)
Component.repaint()
. (If you do not see the line, it may not have been added to
a visible container, it may be behind another graphic, its color may blend with the background, or
its coordinates may be outside the visible region of the container.)
paint
in class JComponent
public String toString()
toString
in class Graphic
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |