📄 myline.java
字号:
import java.awt.*;
public class Myline extends Myshape
{
private int xp,yp;
public Myline()
{
setMyline(0,0);
}
public Myline(int x1,int y1,int p1,int x2,int y2)
{
super(x1,y1,p1);
setMyline(x2,y2);
}
public void setMyline(int xcoordinate,int ycoordinate)
{
xp = xcoordinate;
yp = ycoordinate;
}
public int getxp()
{
return xp;
}
public int getyp()
{
return yp;
}
public void draw(Graphics g)
{
g.setColor(Color.magenta);
g.drawLine(super.getx(),super.gety(),getxp(),getyp());
}
public String toString()
{
return super.toString()+"point2:["+getxp()+","+getyp()+"]";
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -