jbuilder 100例 java源码学习,非常不错,有需要朋友下来

源代码在线查看: draw.java~8~

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

相关代码

				package line;								import java.awt.*;				import java.awt.event.*;				import java.applet.*;								public class draw extends Applet {				  Point spoint;				  Point points[];				  int nump;				  boolean drawing = false;				  boolean isStandalone = false;				  /**Get a parameter value*/				  public String getParameter(String key, String def) {				    return isStandalone ? System.getProperty(key, def) :				      (getParameter(key) != null ? getParameter(key) : def);				  }				  public void init(){				     spoint=new Point(0,0);				     points=new Point[1000];				     nump=0;				     drawing=false;				  }				  public boolean handleEvent(Event e){				     switch(e.id){				        case Event.MOUSE_DOWN :				            drawing = !drawing;				            if(drawing){				               spoint.x=e.x;				               spoint.y=e.y;				            }				            return true;				        case Event.MOUSE_MOVE :				            if((drawing)&&(nump				                  points[nump]=new Point(e.x,e.y);				                  ++nump;				                  repaint();				             }				             return true;				         default:				              return false;				      }				  }				  public void paint(Graphics g){				     int oldx=spoint.x;				     int oldy=spoint.y;				     for(int x=0;x				         g.drawLine(oldx,oldy,points[x].x,points[x].y);				         oldx=points[x].x;				         oldy=points[x].y;				      }				   }				  /**Construct the applet*/				  public draw() {				  }				  /**Initialize the applet*/								  /**Component initialization*/				  private void jbInit() throws Exception {				  }				  /**Get Applet information*/				  public String getAppletInfo() {				    return "Applet Information";				  }				  /**Get parameter info*/				  public String[][] getParameterInfo() {				    return null;				  }				}							

相关资源