类的设计
Pool 继承 JPanel
background
Fish[] allFish
FishingNet fishingNet
Fish
x
y
width
height
images
index
image
FishingNet
x
y
width
height
image
素材在最下面:ps技术有限 不喜欢的可以自己画!!!
package xyz.rhel.fish;
import java.awt.image.BufferedImage;
import java.io.File;
import javax.imageio.ImageIO;
public class FishingNet {
private int x;
private int y;
private int width;
private int height;
private BufferedImage image;
private boolean show;
public FishingNet(String img) throws Exception {
image = ImageIO.read(new File(img));
width = image.getWidth();
height = image.getHeight();
}
public int getWidth() {
return width;
}
public void setWidth(int width) {
this.width = width;
}
public int getHeight() {
return height;
}
public void setHeight(int height) {
this.height = height;
}
public int getX() {
return x;
}
public void setX(int x) {
this.x = x;
}
public int getY() {
return y;
}
public void setY(int y) {
this.y = y;
}
public BufferedImage getImage() {
return image;
}
public void setImage(BufferedImage image) {
this.image = image;
}
public boolean isShow(){
return show;
}
public void setShow(boolean show){
this.show = show;
}
}
package xyz.rhel.fish;
import java.awt.image.BufferedImage;
import java.io.File;
import java.util.Random;
import javax.imageio.ImageIO;
public class Fish implements Runnable {
private int x;
private int y;
private int width;
private int height;
private int index;
private int step;
private BufferedImage[] images;
private BufferedImage image;
public int getX() {
return x;
}
public void setX(int x) {
this.x = x;
}
public int getY() {
return y;
}
public void setY(int y) {
this.y = y;
}
public int getWidth() {
return width;
}
public void setWidth(int width) {
this.width = width;
}
public int getHeight() {
return height;
}
public void setHeight(int height) {
this.height = height;
}
public int getIndex() {
return index;
}
public void setIndex(int index) {
this.index = index;
}
public int getStep() {
return step;
}
public void setStep(int step) {
this.step = step;
}
public BufferedImage[] getImages() {
return images;
}
public void setImages(BufferedImage[] images) {
this.images = images;
}
public BufferedImage getImage() {
return image;
}
public void setImage(BufferedImage image) {
this.im