Beispiel #1
0
  public D(String title) {
    super(title);
    setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);
    int frameWidth = 410;
    int frameHeight = 319;
    setSize(frameWidth, frameHeight);
    Dimension d = Toolkit.getDefaultToolkit().getScreenSize();
    int x = (d.width - getSize().width) / 2;
    int y = (d.height - getSize().height) / 2;
    setLocation(x, y);
    setResizable(false);
    Container cp = getContentPane();
    cp.setLayout(null);

    label1.setBounds(8, 8, 275, 76);
    label1.setText("Würfel");
    label1.setAlignment(Label.CENTER);
    label1.setFont(new Font("Dialog", Font.PLAIN, 60));
    cp.add(label1);
    l_1.setBounds(8, 88, 275, 145);
    l_1.setText("");
    l_1.setAlignment(Label.CENTER);
    l_1.setFont(new Font("Dialog", Font.PLAIN, 100));

    cp.add(l_1);
    b_1.setBounds(8, 248, 275, 25);
    b_1.setLabel("Würfeln");
    b_1.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent evt) {
            b_1_ActionPerformed(evt);
          }
        });
    cp.add(b_1);
    tf_von.setBounds(336, 80, 49, 25);
    cp.add(tf_von);
    tf_bis.setBounds(336, 120, 49, 25);
    cp.add(tf_bis);
    l_von.setBounds(296, 80, 35, 25);
    l_von.setText("Von:");
    cp.add(l_von);
    l_bis.setBounds(296, 120, 35, 25);
    l_bis.setText("Bis:");
    cp.add(l_bis);
    b_a.setBounds(296, 160, 89, 49);
    b_a.setLabel("Annehmen");
    b_a.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent evt) {
            b_a_ActionPerformed(evt);
          }
        });
    cp.add(b_a);

    setVisible(true);
  }
Beispiel #2
0
 private void initcomp() {
   this.setLayout(null);
   this.setLocation(249, 135);
   this.setSize(300, 400);
   this.addWindowListener(
       new WindowAdapter() {
         public void windowClosing(WindowEvent we) {
           System.exit(0);
         }
       });
   this.add(btn1);
   this.add(btn2);
   this.add(btn3);
   btn1.setBounds(50, 50, 50, 100);
   btn2.setBounds(200, 50, 50, 100);
   btn3.setBounds(50, 200, 200, 50);
   btn1.setBackground(Color.CYAN);
   btn2.setBackground(Color.BLACK);
   btn2.setForeground(Color.WHITE);
   btn3.setBackground(Color.YELLOW);
   this.setTitle(Integer.toString(i));
   btn1.addActionListener(
       new ActionListener() {
         public void actionPerformed(ActionEvent arg0) {
           // TODO Auto-generated method stub
           i++;
           ct();
         }
       });
   btn2.addActionListener(
       new ActionListener() {
         public void actionPerformed(ActionEvent arg0) {
           // TODO Auto-generated method stub
           i--;
           ct();
         }
       });
   btn3.addActionListener(
       new ActionListener() {
         public void actionPerformed(ActionEvent arg0) {
           // TODO Auto-generated method stub
           System.exit(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);
          }
        });
  }
  OuterEventDemo(String s) {
    f = new Frame(s);
    f.addWindowListener(new WindowsEventListner());
    b = new Button("OK");
    b1 = new Button("CANCEL");
    b.setBounds(20, 100, 40, 40);
    b1.setBounds(20, 180, 40, 40);
    f.add(b);
    f.add(b1);

    b.addMouseListener(new MouseEventListener(this));
    b1.addMouseListener(new MouseEventListener(this));
    Outer o = new Outer(this);
    b.addActionListener(o);
    b1.addActionListener(o);

    tf = new TextField();
    tf.setBounds(20, 40, 100, 40);
    f.add(tf);
    tf.addKeyListener(new KeyEventListener());
    f.setLayout(null);
    f.setSize(400, 400);
    f.setVisible(true);
  }
Beispiel #5
0
  public Deta_Ventas_r() {
    setBackground(Color.gray);
    setLayout(null);
    setSize(400, 400);
    l1 = new Label(" clave ");
    t1 = new TextField(36);
    l2 = new Label("Vendedor");
    t2 = new TextField(20);

    l3 = new Label("Cliente");
    t3 = new TextField(20);
    l4 = new Label("Fechas");
    t4 = new TextField(5);
    l5 = new Label("monto_final");
    t5 = new TextField(5);
    t4.setEditable(false);
    t5.setEditable(false);
    b = new Button("Registrar");
    add(l1);
    add(t1);
    add(l2);
    add(t2);
    add(l3);
    add(t3);
    add(l4);
    add(t4);
    add(l5);
    add(t5);
    add(b);
    l1.setBounds(24, 75, 71, 23);
    l2.setBounds(24, 103, 90, 23);
    l3.setBounds(24, 131, 90, 23);
    l4.setBounds(24, 159, 90, 23);
    l5.setBounds(24, 185, 90, 23);
    t1.setBounds(114, 75, 270, 23);
    t2.setBounds(114, 103, 270, 23);
    t3.setBounds(114, 131, 270, 23);
    t4.setBounds(114, 159, 270, 23);
    t5.setBounds(114, 185, 270, 23);
    b.setBounds(167, 215, 65, 23);
    b.addActionListener(this);
    setUndecorated(true);
    setLocation((Toolkit.getDefaultToolkit().getScreenSize().width / 2) - 200, 50);
    start();
  }
Beispiel #6
0
  public ReciveFile() {
    super("파일전송");
    setLayout(null);
    lbl = new Label("파일 전송을 기다립니다.");
    lbl.setBounds(10, 30, 230, 20);
    lbl.setBackground(Color.gray);
    lbl.setForeground(Color.white);
    add(lbl);
    txt = new TextArea("", 0, 0, TextArea.SCROLLBARS_BOTH);
    txt.setBounds(10, 60, 230, 100);
    txt.setEditable(false);
    add(txt);
    btn = new Button("닫기");
    btn.setBounds(105, 170, 40, 20);
    btn.setVisible(false);
    btn.addActionListener(this);
    add(btn);
    addWindowListener(new WinListener());
    setSize(250, 200);
    show();

    try {
      ServerSocket socket = new ServerSocket(port);
      Socket sock = null;
      FileThread client = null;
      try {
        sock = socket.accept();
        client = new FileThread(this, sock);
        client.start();
      } catch (IOException e) {
        System.out.println(e);
        try {
          if (sock != null) sock.close();
        } catch (IOException e1) {
          System.out.println(e1);
        } finally {
          sock = null;
        }
      }
    } catch (IOException e) {
    }
  }
Beispiel #7
0
 public LoginScreen(final Home hm) {
   setSize(600, 550);
   setLayout(null);
   this.hm = hm;
   name = new Label("Username : "******"Password :"******"login");
   login.addActionListener(
       new ActionListener() {
         public void actionPerformed(ActionEvent e) {
           try {
             if (isValidUser()) {
               hm.removeAll();
               hm.userId = nameText.getText();
               hm.p2 = new BaseApplet(hm);
               hm.p2.setBounds(0, 50, 600, 550);
               hm.add(hm.p2);
               hm.revalidate();
             } else {
               JOptionPane.showMessageDialog(
                   null, "Invalid Credentials", "Alert", JOptionPane.OK_OPTION);
             }
           } catch (Exception e1) {
             System.out.println("Error");
           }
         }
       });
   login.setBounds(200, 150, 100, 30);
   add(login);
 }
  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();
  }
Beispiel #9
0
  void launch() {
    f.setSize(800, 800);
    p.setLayout(null);

    l1.setBounds(600, 10, 150, 36);

    l2.setBounds(100, 30, 400, 70);
    l13.setBounds(2, 90, 1200, 20);

    l14.setBounds(80, 150, 250, 30);
    t1.setBounds(330, 150, 150, 30);
    b1.setBounds(500, 150, 100, 30);
    l15.setBounds(2, 200, 1200, 20);

    b6.setBounds(600, 50, 100, 30);
    l3.setBounds(100, 250, 100, 30);
    t2.setBounds(300, 250, 150, 30);
    l4.setBounds(100, 300, 150, 30);
    t3.setBounds(300, 300, 150, 30);
    l5.setBounds(100, 350, 150, 30);
    t4.setBounds(300, 350, 150, 30);
    l6.setBounds(100, 400, 100, 30);
    t5.setBounds(300, 400, 150, 30);
    l7.setBounds(100, 450, 100, 30);
    c1.setBounds(300, 450, 60, 30);
    c2.setBounds(400, 450, 60, 30);
    l8.setBounds(100, 500, 100, 30);
    t6.setBounds(300, 500, 150, 30);
    l9.setBounds(100, 550, 100, 30);
    t7.setBounds(300, 550, 150, 30);
    l10.setBounds(100, 600, 120, 30);
    t8.setBounds(300, 600, 150, 30);

    l11.setBounds(100, 650, 100, 30);
    t9.setBounds(300, 650, 150, 30);
    l12.setBounds(100, 700, 150, 30);
    t10.setBounds(300, 700, 150, 30);
    b2.setBounds(500, 400, 100, 30);
    b3.setBounds(500, 500, 100, 30);
    b4.setBounds(500, 600, 100, 30);
    b5.setBounds(650, 150, 100, 30);

    b1.addActionListener(this);
    b2.addActionListener(this);
    b3.addActionListener(this);
    b4.addActionListener(this);
    b5.addActionListener(this);
    b6.addActionListener(this);
    c1.addItemListener(this);
    c2.addItemListener(this);

    p.add(l1);
    p.add(l2);
    p.add(l13);
    p.add(l14);
    p.add(t1);
    p.add(b1);
    p.add(l15);
    p.add(b5);
    p.add(b6);

    f.add(p);

    f.setVisible(true);
    f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
  }