📄 bar.java
字号:
import java.awt.*;
//Download by http://www.codefans.net
//画竖型方格的Bar类继承Squareshape类
class Bar extends SquareShape
{
private Color barColor=new Color(120,107,223);//蓝,设置颜色为蓝色
public Bar()//构造函数
{
super();//初始化基类的属性
this.color=barColor;
}
//默认是各个方格的位置
protected void defaultRotate()
{
for(int i=0;i<4;i++)
{
position[i][0]=xpos;
position[i][1]=ypos+i*20;
}
}
//第一次旋转后各方格的位置
protected void firstRotate()
{
for(int i=0;i<4;i++)
{
position[i][0]=xpos+i*20;
position[i][1]=ypos;
}
}
//第二次旋转后各方格的位置
protected void secondRotate()
{
this.defaultRotate();
}
//第三次旋转后各方格的位置
protected void thirdRotate()
{
this.firstRotate();
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -