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

📄 zhe.java

📁 Jbuilder100个例子 都是经典例子 对大家学习Jbuilder非常有帮助
💻 JAVA
字号:
package line;import java.awt.*;import java.awt.event.*;import java.applet.*;public class zhe extends Applet {  int x1=-1,y1=-1;  boolean flag=true;  int x2,y2;  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);  }  /**Construct the applet*/  public zhe() {  }  /**Initialize the applet*/  public void init() {    try {      jbInit();    }    catch(Exception e) {      e.printStackTrace();    }  }  /**Component initialization*/  private void jbInit() throws Exception {    this.setBackground(Color.white);    this.addMouseListener(new java.awt.event.MouseAdapter() {      public void mousePressed(MouseEvent e) {        this_mousePressed(e);      }    });  }  /**Get Applet information*/  public String getAppletInfo() {    return "Applet Information";  }  /**Get parameter info*/  public String[][] getParameterInfo() {    return null;  }  void this_mousePressed(MouseEvent e) {  flag=!flag;  if(flag==true){      x1=e.getX();      y1=e.getY();  }  else{      x2=e.getX();      y2=e.getY();  }  if(x1!=-1 && y1!=-1)  repaint();  }  public void update(Graphics g){    paint(g);  }  public void paint(Graphics g){  g.setColor(Color.red);  g.drawLine(x1,y1,x2,y2);  }}

⌨️ 快捷键说明

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