java21:捕鱼达人

类的设计 

    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
  • 1
    点赞
  • 5
    收藏
    觉得还不错? 一键收藏
  • 1
    评论
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值