Esempio n. 1
0
  public Bai2() {

    lbNumber1.setText("a =");
    lbNumber2.setText("b =");
    lbResult.setText("Kết quả:");
    txtNumber1.setText("0");
    txtNumber2.setText("0");
    txtResult.setText("0");
    btResult.setLabel("Thực hiện");
    choCalculator.add("Cộng");
    choCalculator.add("Trừ");
    choCalculator.add("Nhân");
    choCalculator.add("Chia");
    choCalculator.add("UCLN");
    choCalculator.add("BCNN");

    frMain.setBounds(100, 100, 400, 300);
    frMain.setBackground(Color.LIGHT_GRAY);
    frMain.setLayout(null);

    lbNumber1.setBounds(30, 50, 50, 20);
    lbNumber2.setBounds(30, 70, 50, 20);
    lbResult.setBounds(30, 140, 50, 20);

    choCalculator.setBounds(300, 70, 60, 20);

    btResult.setBounds(100, 100, 100, 20);

    txtNumber1.setBounds(100, 50, 150, 20);
    txtNumber2.setBounds(100, 70, 150, 20);
    txtResult.setBounds(100, 140, 150, 20);

    frMain.add(lbNumber1);
    frMain.add(lbNumber2);
    frMain.add(lbResult);
    frMain.add(txtNumber1);
    frMain.add(txtNumber2);
    frMain.add(txtResult);
    frMain.add(btResult);
    frMain.add(choCalculator);

    btResult.addActionListener(new ProcessButton());

    frMain.addWindowListener(
        new WindowAdapter() {
          public void windowsClosing(WindowEvent evt) {
            System.exit(0);
          }
        });
  }
 {
   clientStatus.add("Online");
   clientStatus.add("Offline");
   clientStatus.add("Busy");
   clientStatus.select("Offline");
   clientStatus.addItemListener(
       new ItemListener() {
         public void itemStateChanged(ItemEvent e) {
           new Thread("icqtest/chooser control handler") {
             public void run() {
               try {
                 if (clientStatus.getSelectedItem().equals("Online")) {
                   if (plugin.getClientStatus(getMyLoginId())
                       == org.jcq2k.MessagingNetwork.STATUS_OFFLINE) login();
                   plugin.setClientStatus(
                       getMyLoginId(), org.jcq2k.MessagingNetwork.STATUS_ONLINE);
                 } else if (clientStatus.getSelectedItem().equals("Busy")) {
                   if (plugin.getClientStatus(getMyLoginId())
                       == org.jcq2k.MessagingNetwork.STATUS_OFFLINE) login();
                   plugin.setClientStatus(getMyLoginId(), org.jcq2k.MessagingNetwork.STATUS_BUSY);
                 } else if (clientStatus.getSelectedItem().equals("Offline")) {
                   if (plugin.getClientStatus(getMyLoginId())
                       != org.jcq2k.MessagingNetwork.STATUS_OFFLINE)
                     plugin.setClientStatus(
                         getMyLoginId(), org.jcq2k.MessagingNetwork.STATUS_OFFLINE);
                 } else {
                   org.jcq2k.util.joe.Lang.ASSERT_FALSE("invalid clientStatus.getSelectedItem()");
                 }
               } catch (Throwable tr) {
                 printException(tr);
               }
             }
           }.start();
         }
       });
 }
Esempio n. 3
0
 Panel5(web main) {
   setLayout(new GridLayout(3, 3));
   lpm = new Checkbox("LPM");
   add(lpm);
   cont = new Checkbox("CONT");
   add(cont);
   cuts = new Choice();
   cuts.add("Vcut 1");
   cuts.add("0.05");
   cuts.add("0.01");
   cuts.add("1.e-3");
   cuts.add("E 500");
   add(cuts);
   scat = new Checkbox("SCAT");
   add(scat);
   time = new Checkbox("TIME");
   add(time);
   brem = new Choice();
   brem.add("BS: KKP");
   brem.add("BS: ABB");
   brem.add("BS: P-S");
   brem.add("BS: CSC");
   add(brem);
   debug = new Checkbox("info", true);
   add(debug);
   inter = new Checkbox("intr");
   add(inter);
   phnu = new Choice();
   phnu.add("BB 1981");
   phnu.add("BB ZEUS");
   phnu.add("BB+HARD");
   phnu.add("ALLM 91");
   phnu.add("ALLM 97");
   phnu.add("BM CKMT");
   add(phnu);
 }
Esempio n. 4
0
  public void init() {
    status = new Label("", Label.CENTER);
    menu = new Panel();
    canvas = new MyCanvas();
    farbe = new Choice();
    color = Color.blue;
    filled = new Checkbox("ausgefuellt");
    namen = new String[] {"Rechteck", "Kreis", "Ellipse"};
    farben = new String[] {"blau", "gelb", "gruen", "rot", "schwarz", "weiss"};
    button = new Button[namen.length];

    type = -1;

    for (int i = 0; i < namen.length; i++) {
      button[i] = new Button(namen[i]);
      button[i].addActionListener(this);
      menu.add(button[i]);
    }

    for (int i = 0; i < farben.length; i++) farbe.add(farben[i]);

    filled.addItemListener(this);
    farbe.addItemListener(this);
    canvas.addMouseListener(this);
    canvas.addMouseMotionListener(this);

    menu.add(filled);
    menu.add(farbe);

    setLayout(new BorderLayout());
    setBackground(Color.lightGray);

    add(menu, "North");
    add(canvas, "Center");
    add(status, "South");
  }
  public void init() {
    try {
      robot = new Robot();
    } catch (AWTException ex) {
      ex.printStackTrace();
      throw new RuntimeException(ex);
    }
    this.setLayout(new BorderLayout());

    target.setBackground(Color.green);
    target.setName("GreenBox"); // for the ease of debug
    target.setPreferredSize(new Dimension(100, 100));
    String toolkit = Toolkit.getDefaultToolkit().getClass().getName();

    // on X systems two buttons are reserved for wheel though they are countable by MouseInfo.
    int buttonsNumber =
        toolkit.equals("sun.awt.windows.WToolkit")
            ? MouseInfo.getNumberOfButtons()
            : MouseInfo.getNumberOfButtons() - 2;

    for (int i = 0; i < 8; i++) {
      buttonNumber.add("BUTTON" + (i + 1) + "_MASK");
    }

    pressOn.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            System.out.println("Now pressing : " + (buttonNumber.getSelectedIndex() + 1));

            Timer timer = new Timer();
            TimerTask robotInteraction =
                new TimerTask() {
                  public void run() {
                    robot.mouseMove(updateTargetLocation().x, updateTargetLocation().y);
                    robot.mousePress(getMask(buttonNumber.getSelectedIndex() + 1));
                  }
                };
            timer.schedule(robotInteraction, SEND_DELAY);
          }
        });

    releaseOn.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            System.out.println("Now releasing : " + (buttonNumber.getSelectedIndex() + 1));
            Timer timer = new Timer();
            TimerTask robotInteraction =
                new TimerTask() {
                  public void run() {
                    robot.mouseMove(updateTargetLocation().x, updateTargetLocation().y);
                    robot.mouseRelease(getMask(buttonNumber.getSelectedIndex() + 1));
                  }
                };
            timer.schedule(robotInteraction, SEND_DELAY);
          }
        });

    clickOn.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            System.out.println("Now clicking : " + (buttonNumber.getSelectedIndex() + 1));
            Timer timer = new Timer();
            TimerTask robotInteraction =
                new TimerTask() {
                  public void run() {
                    robot.mouseMove(updateTargetLocation().x, updateTargetLocation().y);
                    robot.mousePress(getMask(buttonNumber.getSelectedIndex() + 1));
                    robot.mouseRelease(getMask(buttonNumber.getSelectedIndex() + 1));
                  }
                };
            timer.schedule(robotInteraction, SEND_DELAY);
          }
        });
    target.addMouseListener(
        new MouseAdapter() {
          public void mousePressed(MouseEvent e) {
            Sysout.println("" + e);
          }

          public void mouseReleased(MouseEvent e) {
            Sysout.println("" + e);
          }

          public void mouseClicked(MouseEvent e) {
            Sysout.println("" + e);
          }
        });

    String[] instructions = {
      "Do provide an instruction to the robot by",
      "choosing the button number to act and ",
      "pressing appropriate java.awt.Button on the left.",
      "Inspect an output in the TextArea below.",
      "Please don't generate non-natural sequences like Release-Release, etc.",
      "If you use keyboard be sure that you released the keyboard shortly.",
      "If events are generated well press Pass, otherwise Fail."
    };
    Sysout.createDialogWithInstructions(instructions);
  } // End  init()
Esempio n. 6
0
  void init(String[] names1, float[][][] pch1, int psfflag1) {
    setLayout(null);
    names = names1;
    pch = pch1;
    psfflag = psfflag1;
    ncurves = pch.length;
    nparams = 11;
    xpts = pch[0].length;
    ypts = pch[0][0].length;

    checkarray = new Checkbox[ncurves];
    include = new boolean[ncurves];
    namearray = new TextField[ncurves + 1];
    int1array = new TextField[ncurves + 1];
    intensity1 = new double[ncurves + 1];
    e1array = new TextField[ncurves + 1];
    n1array = new TextField[ncurves + 1];
    bright1 = new double[ncurves + 1];
    number1 = new double[ncurves + 1];
    int2array = new TextField[ncurves + 1];
    intensity2 = new double[ncurves + 1];
    e2array = new TextField[ncurves + 1];
    n2array = new TextField[ncurves + 1];
    bright2 = new double[ncurves + 1];
    number2 = new double[ncurves + 1];
    eccarray = new TextField[ncurves + 1];
    brightcc = new double[ncurves + 1];
    eminccarray = new TextField[ncurves + 1];
    brightmincc = new double[ncurves + 1];
    c2array = new TextField[ncurves + 1];
    c2 = new double[ncurves + 1];
    nmeas = new int[ncurves + 1];
    avg = new float[xpts][ypts];
    indices = new int[ncurves];
    beta = 0.05;

    getintbright();
    for (int i = 0; i < ncurves; i++) {
      include[i] = true;
      indices[i] = i;
    }
    updateavg();

    int starty = 60;
    int startx = 10;
    int yinc = 25;
    for (int i = 0; i <= ncurves; i++) {
      if (i != ncurves) {
        checkarray[i] = new Checkbox("", include[i]);
        checkarray[i].setBounds(startx, starty + i * yinc, 20, 20);
        checkarray[i].addItemListener(this);
        add(checkarray[i]);
      }

      namearray[i] = new TextField(names[i]);
      namearray[i].setBounds(startx + 30, starty + i * yinc, 200, 20);
      add(namearray[i]);

      int1array[i] = new TextField("" + (float) intensity1[i]);
      int1array[i].setBounds(startx + 30 + 210, starty + i * yinc, 40, 20);
      add(int1array[i]);

      e1array[i] = new TextField("" + (float) bright1[i]);
      e1array[i].setBounds(startx + 30 + 210 + 50, starty + i * yinc, 40, 20);
      add(e1array[i]);

      n1array[i] = new TextField("" + (float) number1[i]);
      n1array[i].setBounds(startx + 30 + 210 + 50 + 50, starty + i * yinc, 40, 20);
      add(n1array[i]);

      int2array[i] = new TextField("" + (float) intensity2[i]);
      int2array[i].setBounds(startx + 30 + 210 + 50 + 50 + 50, starty + i * yinc, 40, 20);
      add(int2array[i]);

      e2array[i] = new TextField("" + (float) bright2[i]);
      e2array[i].setBounds(startx + 30 + 210 + 50 + 50 + 50 + 50, starty + i * yinc, 40, 20);
      add(e2array[i]);

      n2array[i] = new TextField("" + (float) number2[i]);
      n2array[i].setBounds(startx + 30 + 210 + 50 + 50 + 50 + 50 + 50, starty + i * yinc, 40, 20);
      add(n2array[i]);

      eccarray[i] = new TextField("" + (float) brightcc[i]);
      eccarray[i].setBounds(
          startx + 30 + 210 + 50 + 50 + 50 + 50 + 50 + 50, starty + i * yinc, 40, 20);
      add(eccarray[i]);

      eminccarray[i] = new TextField("" + (float) brightmincc[i]);
      eminccarray[i].setBounds(
          startx + 30 + 210 + 50 + 50 + 50 + 50 + 50 + 50 + 50, starty + i * yinc, 40, 20);
      add(eminccarray[i]);

      c2[i] = 0.0;
      c2array[i] = new TextField("" + (float) c2[i]);
      c2array[i].setBounds(
          startx + 30 + 210 + 50 + 50 + 50 + 50 + 50 + 50 + 50 + 50, starty + i * yinc, 80, 20);
      add(c2array[i]);
    }

    namelabel = new Label("Filename");
    namelabel.setBounds(startx + 30, starty - 25, 100, 20);
    add(namelabel);

    intlabel = new Label("<Ig>");
    intlabel.setBounds(startx + 30 + 210, starty - 25, 40, 20);
    add(intlabel);

    brightlabel = new Label("<eg>");
    brightlabel.setBounds(startx + 30 + 210 + 50, starty - 25, 40, 20);
    add(brightlabel);

    nlabel = new Label("<Ng>");
    nlabel.setBounds(startx + 30 + 210 + 50 + 50, starty - 25, 40, 20);
    add(nlabel);

    int2label = new Label("<Ir>");
    int2label.setBounds(startx + 30 + 210 + 50 + 50 + 50, starty - 25, 40, 20);
    add(int2label);

    bright2label = new Label("<er>");
    bright2label.setBounds(startx + 30 + 210 + 50 + 50 + 50 + 50, starty - 25, 40, 20);
    add(bright2label);

    n2label = new Label("<Nr>");
    n2label.setBounds(startx + 30 + 210 + 50 + 50 + 50 + 50 + 50, starty - 25, 40, 20);
    add(n2label);

    brightcclabel = new Label("<ecc>");
    brightcclabel.setBounds(startx + 30 + 210 + 50 + 50 + 50 + 50 + 50 + 50, starty - 25, 40, 20);
    add(brightcclabel);

    brightccminlabel = new Label("min");
    brightccminlabel.setBounds(
        startx + 30 + 210 + 50 + 50 + 50 + 50 + 50 + 50 + 50, starty - 25, 40, 20);
    add(brightccminlabel);

    c2label = new Label("chi^2");
    c2label.setBounds(
        startx + 30 + 210 + 50 + 50 + 50 + 50 + 50 + 50 + 50 + 50, starty - 25, 80, 20);
    add(c2label);

    int buttonsx = startx + 30 + 210 + 50 + 50 + 50 + 50 + 50 + 50 + 50 + 50 + 90;

    fitavgbutton = new Button("Fit Avg");
    fitavgbutton.setBounds(buttonsx, starty - 25, 100, 40);
    fitavgbutton.addActionListener(this);
    add(fitavgbutton);

    fitglobalbutton = new Button("Fit Global");
    fitglobalbutton.setBounds(buttonsx, starty - 25 + 50, 100, 40);
    fitglobalbutton.addActionListener(this);
    add(fitglobalbutton);

    clearparamsbutton = new Button("Reset Fit Params");
    clearparamsbutton.setBounds(buttonsx, starty - 25 + 50 + 50, 100, 40);
    clearparamsbutton.addActionListener(this);
    add(clearparamsbutton);

    checkc2 = false;

    fitclass = new NLLSfit(this, 0.0001, 50, 0.1);
    globalfitclass = new NLLSglobalfit(this, 0.0001, 50, 0.1);
    pchfunc = new pch2D((int) ((double) xpts * 1.5), (int) ((double) ypts * 1.5), psfflag);
    avgfit = new float[xpts][ypts];
    fit = new float[ncurves][xpts][ypts];

    xvals = new float[ncurves][xpts][ypts];
    for (int i = 0; i < ncurves; i++) {
      for (int j = 0; j < xpts; j++) {
        for (int k = 0; k < ypts; k++) {
          xvals[i][j][k] = (float) k;
          fit[i][j][k] = 1.0f;
        }
      }
    }

    globalc2label = new Label("Global chi^2 = " + (float) 0.0);
    globalc2label.setBounds(buttonsx, starty - 25 + 50 + 50 + 50, 140, 20);
    add(globalc2label);

    dispcurvelabel = new Label("Display Fit #");
    dispcurvelabel.setBounds(buttonsx, starty - 25 + 50 + 50 + 50 + 30, 70, 20);
    add(dispcurvelabel);

    dispcurvechoice = new Choice();
    for (int i = 0; i < ncurves; i++) {
      dispcurvechoice.add("" + (i + 1));
    }
    dispcurve = 0;
    dispcurvechoice.select(0);
    dispcurvechoice.setBounds(buttonsx + 80, starty - 25 + 50 + 50 + 50 + 30, 40, 20);
    dispcurvechoice.addItemListener(this);
    add(dispcurvechoice);

    betalabel = new Label("Bleedthrough f");
    betalabel.setBounds(buttonsx, starty - 25 + 50 + 50 + 50 + 30 + 30, 100, 20);
    add(betalabel);
    betaval = new TextField("" + (float) beta);
    betaval.setBounds(buttonsx + 110, starty - 25 + 50 + 50 + 50 + 30 + 30, 40, 20);
    betaval.addActionListener(this);
    add(betaval);

    beta = Double.parseDouble(betaval.getText());
    updatebeta();

    undobutton = new Button("Undo Global Fit");
    undobutton.setBounds(buttonsx, starty - 25 + 50 + 50 + 50 + 30 + 30 + 50, 100, 40);
    undobutton.addActionListener(this);
    add(undobutton);

    geterrorsbutton = new Button("Get Errors");
    geterrorsbutton.setBounds(buttonsx, starty - 25 + 50 + 50 + 50 + 30 + 30 + 50 + 50, 100, 40);
    geterrorsbutton.addActionListener(this);
    add(geterrorsbutton);

    copylabel = new Label("copyright 2009 Jay Unruh ([email protected]) non-profit use only");
    copylabel.setBounds(10, 790, 400, 20);
    add(copylabel);

    n_b_label = new Label("N and B Analysis");
    n_b_label.setBounds(250, 10, 100, 20);
    add(n_b_label);

    pwavg = new PlotWindow3D("Avg", "kg", "kr", "Frequency", avg, 0);
    pwavg.setLogAxes(false, false, true);
    pwavg.draw();
    pwavg.addPoints(avgfit, true, 0);
    float[] temp = pwavg.getLimits();
    temp[4] = 1.0f;
    pwavg.setLimits(temp);

    float[][] temppch = new float[xpts][ypts];
    for (int i = 0; i < xpts; i++) {
      System.arraycopy(pch[dispcurve][i], 0, temppch[i], 0, ypts);
    }
    pwfit = new PlotWindow3D("Selected Curve", "kg", "kr", "Frequency", temppch, 0);
    pwfit.setLogAxes(false, false, true);
    pwfit.draw();
    pwfit.addPoints(fit[dispcurve], true, 0);
    float[] temp2 = pwfit.getLimits();
    temp2[4] = 1.0f;
    pwfit.setLimits(temp2);

    resetparams();
    repaint();
  }
Esempio n. 7
0
 Panel3(web main) {
   main.panel4 = new Panel4(main);
   add(main.panel4);
   main.panel5 = new Panel5(main);
   add(main.panel5);
   medi = new Choice();
   medi.add("water");
   medi.add("ice");
   medi.add("salt");
   medi.add("standard rock");
   medi.add("frejus rock");
   medi.add("iron");
   medi.add("hydrogen");
   medi.add("lead");
   medi.add("uranium");
   medi.add("air");
   medi.add("mineral oil");
   medi.add("antares water");
   medi.select(1);
   add(medi);
   type = new Choice();
   type.add("mu");
   type.add("tau");
   type.add("e");
   type.add("mpl");
   type.add("all");
   add(type);
   romb = new Choice();
   romb.add("3");
   romb.add("4");
   romb.add("5");
   romb.select(2);
   add(romb);
   Romb = new Label("romb", Label.CENTER);
   add(Romb);
 }
Esempio n. 8
0
  mupdate() {
    f = new JFrame("POS");
    p = new Panel();
    l1 = new Label("Welcome:Admin");
    l2 = new Label("POINT   OF   SALE");
    l14 = new Label("Enter Manager_Id");

    l3 = new Label("Name");
    l4 = new Label("Father's_Name");
    l5 = new Label("Manager_Id");
    l6 = new Label("Password");
    l7 = new Label("Gender");
    l9 = new Label("Address");
    l8 = new Label("D.O.B.");
    l10 = new Label("Contact_No.");
    l11 = new Label("E-Mail_Id");
    l12 = new Label("Location");
    l13 =
        new Label(
            "_______________________________________________________________________________________________");

    l15 =
        new Label(
            "_______________________________________________________________________________________________________________________");
    cbg = new CheckboxGroup();
    c1 = new Checkbox("Male", cbg, false);
    c2 = new Checkbox("Female", cbg, false);

    t11 = new TextField();
    t2 = new TextField();
    t3 = new TextField();
    t4 = new TextField();
    t5 = new TextField();
    t6 = new TextField();
    t7 = new TextField();
    t8 = new TextField();
    t9 = new TextField();
    t10 = new TextField();

    try {
      t1 = new Choice();
      Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
      Connection con = DriverManager.getConnection("jdbc:odbc:raman1");
      Statement stm = con.createStatement();
      ResultSet rs = stm.executeQuery("select * from mprofile");
      while (rs.next()) {
        String a2 = rs.getString(3);
        t1.add(a2);
      }
    } catch (Exception e) {
      System.out.println(e);
    }

    b1 = new Button("Search");
    b2 = new Button("Update");
    b3 = new Button("Calendar");
    b4 = new Button("Close");
    b5 = new Button("Back");
    b6 = new Button("Logout");

    f1 = new Font("sherif", Font.BOLD | Font.ITALIC, 45);
    f2 = new Font("sherif", Font.BOLD | Font.ITALIC, 30);
    f3 = new Font("sherif", Font.BOLD | Font.ITALIC, 35);
    f4 = new Font("sherif", Font.BOLD, 20);
    f5 = new Font("sherif", Font.BOLD | Font.ITALIC, 15);
    f6 = new Font("sherif", Font.BOLD | Font.ITALIC, 20);
    l1.setFont(f5);
    l2.setFont(f1);
    l3.setFont(f6);
    l4.setFont(f6);
    l5.setFont(f6);
    l6.setFont(f6);
    l7.setFont(f6);
    l8.setFont(f6);
    l9.setFont(f6);
    l10.setFont(f6);
    l11.setFont(f6);
    l12.setFont(f6);
    l13.setFont(f6);
    l14.setFont(f6);

    b1.setFont(f6);
    b2.setFont(f6);
    b3.setFont(f6);
    b4.setFont(f6);
    b5.setFont(f6);
    b6.setFont(f6);
  }
Esempio n. 9
0
  paintboard1(String s) {
    super(s);
    addMouseMotionListener(this);
    addMouseListener(this);

    paintInfo = new Vector();

    /* 各工具按钮及选择项 */
    // 颜色选择
    ColChoice = new Choice();
    ColChoice.add("black");
    ColChoice.add("red");
    ColChoice.add("blue");
    ColChoice.add("green");
    ColChoice.addItemListener(this);
    // 画笔大小选择
    SizeChoice = new Choice();
    SizeChoice.add("1");
    SizeChoice.add("3");
    SizeChoice.add("5");
    SizeChoice.add("7");
    SizeChoice.add("9");
    SizeChoice.addItemListener(this);
    // 橡皮大小选择
    EraserChoice = new Choice();
    EraserChoice.add("5");
    EraserChoice.add("9");
    EraserChoice.add("13");
    EraserChoice.add("17");
    EraserChoice.addItemListener(this);
    // //////////////////////////////////////////////////
    toolPanel = new Panel();

    clear = new Button("清除");
    eraser = new Button("橡皮");
    pen = new Button("画笔");
    drLine = new Button("画直线");
    drCircle = new Button("画圆形");
    drRect = new Button("画矩形");

    openPic = new Button("打开图画");
    savePic = new Button("保存图画");

    colchooser = new Button("显示调色板");

    // 各组件事件监听
    clear.addActionListener(this);
    eraser.addActionListener(this);
    pen.addActionListener(this);
    drLine.addActionListener(this);
    drCircle.addActionListener(this);
    drRect.addActionListener(this);
    openPic.addActionListener(this);
    savePic.addActionListener(this);
    colchooser.addActionListener(this);

    颜色 = new Label("画笔颜色", Label.CENTER);
    大小B = new Label("画笔大小", Label.CENTER);
    大小E = new Label("橡皮大小", Label.CENTER);
    // 面板添加组件
    toolPanel.add(openPic);
    toolPanel.add(savePic);

    toolPanel.add(pen);
    toolPanel.add(drLine);
    toolPanel.add(drCircle);
    toolPanel.add(drRect);

    toolPanel.add(颜色);
    toolPanel.add(ColChoice);
    toolPanel.add(大小B);
    toolPanel.add(SizeChoice);
    toolPanel.add(colchooser);

    toolPanel.add(eraser);
    toolPanel.add(大小E);
    toolPanel.add(EraserChoice);

    toolPanel.add(clear);
    // 工具面板到APPLET面板
    add(toolPanel, BorderLayout.NORTH);

    setBounds(230, 50, 900, 650);
    setVisible(true);
    validate();
    // dialog for save and load

    openPicture = new FileDialog(this, "打开图画", FileDialog.LOAD);
    openPicture.setVisible(false);
    savePicture = new FileDialog(this, "保存图画", FileDialog.SAVE);
    savePicture.setVisible(false);

    openPicture.addWindowListener(
        new WindowAdapter() {
          public void windowClosing(WindowEvent e) {
            openPicture.setVisible(false);
          }
        });

    savePicture.addWindowListener(
        new WindowAdapter() {
          public void windowClosing(WindowEvent e) {
            savePicture.setVisible(false);
          }
        });

    addWindowListener(
        new WindowAdapter() {
          public void windowClosing(WindowEvent e) {
            System.exit(0);
          }
        });
  }