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

📄 applet1.java

📁 类javaScript脚本解释器
💻 JAVA
字号:
package MultiScriptParse.Parse;

import java.awt.*;
import java.awt.event.*;
import java.applet.*;
import java.util.*;
import java.lang.reflect.*;
import java.net.*;

/**
 * <p>Title: </p>
 * <p>Description: </p>
 * <p>Copyright: Copyright (c) 2006</p>
 * <p>Company: </p>
 * @author not attributable
 * @version 1.0
 */

public class Applet1 extends Applet {
  public static JMParse spMParse = new JMParse(true);
  private boolean isStandalone = false;
  Button button1 = new Button();
  Panel panel1 = new Panel();
  Label label1 = new Label();Integer.
  JMParse mm = new JMParse(true);
  GridLayout gridLayout1 = new GridLayout();
  GridLayout gridLayout2 = new GridLayout();
  java.awt.List list1 = new java.awt.List();
  Scrollbar scrollbar1 = new Scrollbar();
  Choice choice1 = new Choice();
  Label label2 = new Label();
  Button button2 = new Button();
  //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 {
      jbInit();
    }
    catch(Exception e) {
      e.printStackTrace();
    }
  }
  //Component initialization
  private void jbInit() throws Exception {
    button1.setLabel("button1");
    button1.addActionListener(new Applet1_button1_actionAdapter(this));
    this.setLayout(gridLayout2);
    label1.setText("label1");
    panel1.setLayout(gridLayout1);
    gridLayout1.setRows(1);
    gridLayout2.setRows(7);
    scrollbar1.setLocale(java.util.Locale.getDefault());
    label2.setText("label2");
    button2.setLabel("button2");
    button2.addActionListener(new Applet1_button2_actionAdapter(this));
    this.add(button1, null);
    this.add(panel1, null);
    panel1.add(label1, null);
    this.add(list1, null);
    this.add(scrollbar1, null);
    this.add(choice1, null);
    this.add(button2, null);
    this.add(label2, null);
    mm.AddObjectLink("button1", button1);
    mm.AddObjectLink("button2", button2);
    mm.AddObjectLink("label2", label2);
    mm.AddObjectLink("label1", label1);
    mm.AddObjectLink("list1", list1);

    mm.LoadScript(new URL(getDocumentBase(), "./Script/dianshi.scp"));
    //mm.Initial();
  }
  //Get Applet information
  public String getAppletInfo() {
    return "Applet Information";
  }
  //Get parameter info
  public String[][] getParameterInfo() {
    return null;
  }

  void button1_actionPerformed(ActionEvent e) {
    String test = "I love";
    button1.setLabel(test);

    StringBuffer s = new StringBuffer(15);
    s.append("i love you");

    label1.setText(s.toString() + "end");
    //button1.setLabel("end");
    char c = 't';
    Date now = new Date();
    NamedObj no = new NamedObj();
    Object oo = no;
    NamedObjArrayList nol = new NamedObjArrayList();
    long oldt = System.currentTimeMillis();
    String tod;
    nol.SortAddElement(new NamedObj("abc"));
    nol.SortAddElement(new NamedObj("abcd"));
    nol.SortAddElement(new NamedObj("aac"));
    nol.SortAddElement(new NamedObj("aaa"));
    nol.SortAddElement(new NamedObj("aa"));
    nol.SortAddElement(new NamedObj("aa"));
    nol.SortAddElement(new NamedObj("ebc1"));
    nol.SortAddElement(new NamedObj("ebc2"));
    nol.SortAddElement(new NamedObj("ebc"));
    nol.SortAddElement(new NamedObj("e"));
    nol.SortAddElement(new NamedObj("1"));

    if (c == 'c')
      c = 'c';
    else if (c == 't')
      c = 't';
    else if (c == 'm')
      c = 'm';
    else c = 'g';

    NamedObjArrayList nn = (NamedObjArrayList)nol.clone();



    StringBuffer ts = new StringBuffer();
    //int i = Integer.parseInt(ts.toString());
    //Object ss[] = {new String(String.valueOf(i))};

    Object ss[] = {new String(nn.SortFindElement("aaa").Name), new Integer(Integer.parseInt("1"))};
    Class cl[]  = {ss[0].getClass(), Integer.TYPE};
    ts.append(nol.SortFindElement("aaa").Name);
    button1.setLabel(ts.toString());
      try{
        list1.add(Integer.TYPE.getClass().getClass().getClass().getName());
        list1.add(ss[1].getClass().getName());

        Method mo = list1.getClass().getMethod("add", cl);
        mo.invoke(list1, ss);
        if (mo == null) label1.setText("method is null");
        mo.invoke(button1, ss);
      } catch (NoSuchMethodException ns){
        button1.setLabel("no sush method");
      } catch (SecurityException se) {
        button1.setLabel("2");
      } catch (IllegalAccessException ie) {
        button1.setLabel("3");
      } catch (IllegalArgumentException ia) {
        button1.setLabel("4");
      } catch (InvocationTargetException it) {
        button1.setLabel("5");
      }
    //}
    /*int a = 5;

    label2.setText(String.valueOf(6-a) + '|' + String.valueOf(a));
    try{
      mm.StartFunction("nn");
      Class cc;
      StringBuffer sb = new StringBuffer(0);
      try{
        for (int y = 0; y < 10; y ++)
          cc = Class.forName("java.lang.String");
        } catch ( ClassNotFoundException ee){

        }

      label1.setText(String.valueOf(System.currentTimeMillis() - oldt));
    }catch (JMParseException je) {
      label1.setText(je.getMessage() + String.valueOf(JMParse.CurrPos));
    }*/
  }

  void button2_actionPerformed(ActionEvent e) {
    try{
      long oldt = System.currentTimeMillis();
      ArrayList al = new ArrayList(0);
      //for (int y = 0; y < 1; y++)

      mm.StartFunction("buttonclick", al);
      label1.setText(String.valueOf(System.currentTimeMillis() - oldt));
    }catch (JMParseException je) {
      label1.setText(je.getMessage());
    }
  }
}

class Applet1_button1_actionAdapter implements java.awt.event.ActionListener {
  Applet1 adaptee;

  Applet1_button1_actionAdapter(Applet1 adaptee) {
    this.adaptee = adaptee;
  }
  public void actionPerformed(ActionEvent e) {
    adaptee.button1_actionPerformed(e);
  }
}

class Applet1_button2_actionAdapter implements java.awt.event.ActionListener {
  Applet1 adaptee;

  Applet1_button2_actionAdapter(Applet1 adaptee) {
    this.adaptee = adaptee;
  }
  public void actionPerformed(ActionEvent e) {
    adaptee.button2_actionPerformed(e);
  }
}

⌨️ 快捷键说明

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