bar.java
来自「Java逐步实现俄罗斯方, 都是JAVA的~~很有用的~~」· Java 代码 · 共 41 行
JAVA
41 行
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 + =
减小字号Ctrl + -
显示快捷键?