public class Line extends Object implements Serializable
| Modifier and Type | Field and Description |
|---|---|
int |
x1
First X coordinate.
|
int |
x2
Second X coordinate.
|
int |
y1
First Y coordinate.
|
int |
y2
Second Y coordinate.
|
| Constructor and Description |
|---|
Line()
Conscturcts a line using empty coordinates.
|
Line(int x1,
int y1,
int x2,
int y2)
Constructs a line using the specifed coordinates.
|
Line(Line line)
Constructs a line using coordinates from the specified line.
|
Line(Point p1,
Point p2)
Constructs a line using the specifed points.
|
| Modifier and Type | Method and Description |
|---|---|
double |
getX1()
Returns first X coordinate.
|
double |
getX2()
Returns second X coordinate.
|
double |
getY1()
Returns first Y coordinate.
|
double |
getY2()
Returns second Y coordinate.
|
void |
setPoint1(Point p1)
Sets first point.
|
void |
setPoint2(Point p2)
Sets second point.
|
void |
setX1(int x1)
Sets first X coordinate.
|
void |
setX2(int x2)
Sets second X coordinate.
|
void |
setY1(int y1)
Sets first Y coordinate.
|
void |
setY2(int y2)
Sets second Y coordinate.
|
public int x1
public int y1
public int x2
public int y2
public Line()
public Line(int x1,
int y1,
int x2,
int y2)
x1 - first X coordinatey1 - first Y coordinatex2 - second X coordinatey2 - second Y coordinatepublic Line(Point p1, Point p2)
p1 - first pointp2 - second pointpublic Line(Line line)
line - line to processpublic double getX1()
public void setX1(int x1)
x1 - first X coordinatepublic double getY1()
public void setY1(int y1)
y1 - first Y coordinatepublic double getX2()
public void setX2(int x2)
x2 - second X coordinatepublic double getY2()
public void setY2(int y2)
y2 - second Y coordinatepublic void setPoint1(Point p1)
p1 - first pointpublic void setPoint2(Point p2)
p2 - second pointCopyright © 2020. All rights reserved.