⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 node.java

📁 贪吃蛇java版本。自己写的
💻 JAVA
字号:
import java.awt.Color;
import java.awt.Graphics;


public class Node {
	private int x;
	private int y;
	private Node next;
	
	public Node(int x, int y, Node next)
	{
		this.x = x;
		this.y = y;
		this.next = next;
	}
	
	public Node(int x, int y)
	{
		this.x = x;
		this.y = y;
		this.next = null;
	}
	
	public Node()
	{
		this.x = 0;
		this.y = 0;
		this.next = null;
	}
	
	public void setX(int x)
	{
		this.x = x;
	}
	
	public void setY(int y)
	{
		this.y = y;
	}
	
	public int getX()
	{
		return this.x;
	}
	
	public int getY()
	{
		return this.y;
	}
	
	public Node getNext()
	{
		return this.next;
	}
	
	public void setNext(Node next)
	{
		this.next = next;
	}
	
	public boolean equals(Node aNode)
	{
		if(this.x == aNode.x && this.y == aNode.y)
			return true;
		else 
			return false;
	}
	
	public void display(Graphics g)
	{
		g.setColor(Color.BLUE);
		g.drawRect(10 * x, 10 * y, 10, 10);
		
		g.setColor(Color.RED);
		g.fillRect(10 * x + 1, 10 * y + 1, 9, 9);
	}
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -