snakegame.java~11~

来自「前段时间帮同学写了个简单动画程序:“贪食蛇的原型”」· JAVA~11~ 代码 · 共 57 行

JAVA~11~
57
字号
package com.cxlife.snake;/** *功能描述:演示如何控制蛇体的运动。 * Author: 张乐! * */import java.awt.*;import java.awt.event.*;import java.applet.*;import javax.swing.*;public class SnakeGame extends Applet {  private boolean isStandalone = false;  private JPanel jPanel1 = JFrame1.jPanel1;  private BorderLayout borderLayout1 = new BorderLayout();  //Get a parameter value  public String getParameter(String key, String def) {    return isStandalone ? System.getProperty(key, def) :      (getParameter(key) != null ? getParameter(key) : def);  }  //Construct the applet  public SnakeGame() {  }  //Initialize the applet  public void init() {    try {      jbInit();    }    catch(Exception e) {      e.printStackTrace();    }  }  //Component initialization  private void jbInit() throws Exception {    this.setLayout(borderLayout1);    jPanel1.addMouseListener(new java.awt.event.MouseAdapter() {      public void mouseClicked(MouseEvent e) {        jPanel1_mouseClicked(e);      }    });    this.add(jPanel1, BorderLayout.CENTER);  }  //Get Applet information  public String getAppletInfo() {    return "Applet Information";  }  //Get parameter info  public String[][] getParameterInfo() {    return null;  }  void jPanel1_mouseClicked(MouseEvent e) {   jPanel1.requestFocus();  }}

⌨️ 快捷键说明

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