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

📄 applet1.java

📁 jbuilder 100例 java源码学习,非常不错,有需要朋友下来
💻 JAVA
字号:
package both;import java.awt.*;import java.awt.event.*;import java.applet.*;public class Applet1 extends Applet {  boolean isStandalone = false;  String name;  Font font = new Font("TimesRoman",Font.BOLD,40);  /**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 Applet1() {  }  /**Initialize the applet*/  public void init() {    try {      name = this.getParameter("name", "");      if(name == null)  name = "Robert";      name = "Hello" + name + "!";    }    catch(Exception e) {      e.printStackTrace();    }    try {      jbInit();    }    catch(Exception e) {      e.printStackTrace();    }  }  /**Component initialization*/  private void jbInit() throws Exception {  }  /**Get Applet information*/  public String getAppletInfo() {    return "Applet Information";  }  /**Get parameter info*/  public String[][] getParameterInfo() {    String[][] pinfo =      {      {"name", "String", ""},      };    return pinfo;  }  public void paint(Graphics g) {    /**@todo: Override this java.awt.Component method*/    g.setFont(font);    g.setColor(Color.blue);    g.drawString(name,5,50);  }  public static void main(String args[]){    System.out.print("Hello");    if(args.length == 0){      System.out.print(" Robert");    }    else{      for (int i = 0;i<args.length;i++){      System.out.print(" "+args[i]);      }    }    System.out.println("!");  }}

⌨️ 快捷键说明

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