很好得jbuilder100例源代码

源代码在线查看: key.java~2~

软件大小: 7100 K
上传用户: buptbaishikele
关键词: jbuilder 100 源代码
下载地址: 免注册下载 普通下载 VIP

相关代码

				package untitled2;								import java.awt.*;				import java.awt.event.*;				import java.applet.*;								public class key extends Applet {				  int x = 150,y = 150;				  boolean isStandalone = false;				  BorderLayout borderLayout1 = new BorderLayout();				  Panel panel1 = new Panel();				  /**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 key() {				  }				  /**Initialize the applet*/				  public void init() {				    try {				      jbInit();				    }				    catch(Exception e) {				      e.printStackTrace();				    }				  }				  /**Component initialization*/				  private void jbInit() throws Exception {				    this.setLayout(borderLayout1);				    panel1.addKeyListener(new java.awt.event.KeyAdapter() {				      public void keyPressed(KeyEvent e) {				        panel1_keyPressed(e);				      }				    });				    this.add(panel1, BorderLayout.CENTER);				  }				  /**Get Applet information*/				  public String getAppletInfo() {				    return "Applet Information";				  }				  /**Get parameter info*/				  public String[][] getParameterInfo() {				    return null;				  }								  void panel1_keyPressed(KeyEvent e) {				     switch(e.getKeyCode()) {				         case e.VK_LEFT:				            x -= 1;				            break;				         case e.VK_RIGHT:				            x += 1;				            break;				         case e.VK_UP:				            y -= 1;				            break;				         case e.VK_DOWN:				            y += 1;				            break;				      }				      panel1.getGraphics().fillOval(x,y,15,15);				     }								}			

相关资源