package sb1;
import java.awt.Graphics;
import java.awt.event.KeyListener;
import javax.swing.JPanel;
import java.awt.*;
import javax.swing.*;
public class SB0 extends JPanel implements KeyListener{
int lenght;
int[] she_x=new int[500];
int[] she_y=new int[500];
String fx;
boolean start=false;
public SB0() {
init();
}
public void init() {
lenght=3;
fx="r";
she_x[0]=100;she_y[0]=100;
she_x[1]=75;she_y[1]=100;
she_x[2]=50;she_y[2]=100;
she_x[3]=25;she_y[3]=100;
}
protected void paintComponent(Graphics g) {
super.paintComponent(g);
int a=1;
new ImageIcon("jpg/狗头_900_100.jpg").paintIcon(this,g,a,1);
g.fillRect(25,75, 850,600);
if(fx.equals("r")) {
new ImageIcon("jpg/right.png").paintIcon(this,g ,she_x[0]+25 ,she_y[0] );
}else if(fx.equals("1")) {
new ImageIcon("jpg/left.png").paintIcon(this,g ,she_x[0]+25 ,she_y[0] );
}else if(fx.equals("u")) {
new ImageIcon("jpg/up.png").paintIcon(this,g ,she_x[0]+25 ,she_y[0] );
}else if(fx.equals("d")) {
new ImageIcon("jpg/down.png").paintIcon(this,g ,she_x[0]+25 ,she_y[0] );
}
for(int i=1;i<=lenght;i++) {
new ImageIcon("jpg/boyd.png").paintIcon(this,g ,she_x[i] ,she_y[i] );
}
if(start==false) {
g.setColor(Color.white);
g.setFont(new Font("微软雅黑",Font.BOLD,40));
g.drawString("按下夏福特开始游戏", 300, 300);
}
}
public void keyPressed(KeyEvent e) {
}
}