刚才没有提供Box类
下面是Box类的代码:import java.awt.*;
public class Box implements Cloneable
{
private boolean isColored = true;
//indicates whether to show the box by the background of canvas
private Dimension dimension = new Dimension();
//include the width and height of box
/**
* construct a new Box by the default width and height which are specified in RussanSqaure
* @param isColored boolean. true indicates to show this box by the background of canvas
* */
public Box(boolean isColored)
{
this.isColored = isColored;
}
/**
* construct a new Box with the spcified isColored and width, height
* @param isColored boolean. true indicates to show this box by the background of canvas
* @param width int. spcify the width of each box
* @param height int. spcify the height of each box
* */
public Box(boolean isColored, int width, int height)
{
this.isColored = isColored;
this.dimension = new Dimension(width, height);
}
/**
* to detect whether this box is shown by the background of canvas
* @return true indicates this box will be shown by the background of canvas
* */
public boolean isColored()
{
return isColored;
}
/**
* to decide whether to set the color of box as the background of canvas or not
* @param isColored boolean. true to set the color of box as the background of canvas
* */
public void setColor(boolean isColored)
{
this.isColored = isColored;
}
/**
* to get the dimesion of box
* @param dimension of box
* */
public Dimension getDimension()
{
return this.dimension;
}
/**
* to custome the clone()method
* @param box Object
* */
public Object clone()
{
Object clonedBox = null;
try
{
clonedBox = super.clone();
}
catch(CloneNotSupportedException e)
{
}
return clonedBox;
} public static void main(String[] args) {
}
}
下面是Box类的代码:import java.awt.*;
public class Box implements Cloneable
{
private boolean isColored = true;
//indicates whether to show the box by the background of canvas
private Dimension dimension = new Dimension();
//include the width and height of box
/**
* construct a new Box by the default width and height which are specified in RussanSqaure
* @param isColored boolean. true indicates to show this box by the background of canvas
* */
public Box(boolean isColored)
{
this.isColored = isColored;
}
/**
* construct a new Box with the spcified isColored and width, height
* @param isColored boolean. true indicates to show this box by the background of canvas
* @param width int. spcify the width of each box
* @param height int. spcify the height of each box
* */
public Box(boolean isColored, int width, int height)
{
this.isColored = isColored;
this.dimension = new Dimension(width, height);
}
/**
* to detect whether this box is shown by the background of canvas
* @return true indicates this box will be shown by the background of canvas
* */
public boolean isColored()
{
return isColored;
}
/**
* to decide whether to set the color of box as the background of canvas or not
* @param isColored boolean. true to set the color of box as the background of canvas
* */
public void setColor(boolean isColored)
{
this.isColored = isColored;
}
/**
* to get the dimesion of box
* @param dimension of box
* */
public Dimension getDimension()
{
return this.dimension;
}
/**
* to custome the clone()method
* @param box Object
* */
public Object clone()
{
Object clonedBox = null;
try
{
clonedBox = super.clone();
}
catch(CloneNotSupportedException e)
{
}
return clonedBox;
} public static void main(String[] args) {
}
}
解决方案 »
- 用ant编译程序找不到lang包
- windows计划任务自动执行java程序怎么做?
- 假如要你输入一个数,如何编写
- 什么是数据库的死锁?
- 内存溢出的困扰
- jni函数参数如何传递中文字符串?
- java里怎么编辑和接发报文?
- 谁能给出一个连接sqlserver数据库的源码,谢
- 如何调用某一个控件的事件处理程序,如btnOK_actionPerformed(ActionEvent e) , 如何构造一个ActionEvent的参数?
- 怎样形成一个字符串,中间含有双引号?
- 狂晕的菜鸟问题,什么函数把字符串的空字符过滤,类似C++的Trim()
- 如何使焦点落在JTextField上后,输入值必须满足一定条件后才可以离开?
这个地方计算错误。i,j互换位置。