Esempio n. 1
1
  public void commandAction(Command command, Displayable displayable) {

    if (command == back) {
      controller.MainMenu();
    }
    if (command == viewStages) {
      busNos = busNo.getString().toUpperCase();
      fetchStagesData(busNos);
    }
    if (command == backToNo) {

      controller.getDisp().setCurrent(this);
    }
    if (command == MapStages) {
      controller.pointresultCanvas.busStagesPoints.removeAllElements();
      for (int mapStages = 0; mapStages < PostionAddress.length - 1; mapStages++) {
        String pos = PostionAddress[mapStages];
        String[] point = StringUtil.split(pos, "||");
        System.out.println(point[0] + "== " + point[1]);
        controller.pointBusStages(point[0], point[1]);
      }

      String pos = PostionAddress[Stages.getSelectedIndex()];
      String[] point = StringUtil.split(pos, "||");
      controller.gotoSpot(point[0], point[1]);
      controller.ShowPointingCanvas();
    }
    if (command == backToPlaces) {

      controller.getDisp().setCurrent(Stages);
    }
    if (command == showBuses) {
      controller.showProgressBar();
      fetchBusNoData();
    }
    if (command == showStages) {
      busNos = busesNearMe.getString(busesNearMe.getSelectedIndex()).toUpperCase();
      fetchStagesData(busNos);
    }
    if (command == viewBusPosition) {

      String[] data = GetBusPosition("Tt");
      String Message = "" + data[0] + "\n" + data[1] + "\n" + data[2];
      controller.showBusPosition(Message, data[3], data[4]);
    }
  }
  void login() {
    try {
      logoutBtn.setEnabled(true);
      contactList.setEditable(false);
      loginBtn.setEnabled(false);
      loginId.setEnabled(false);
      password.setEnabled(false);

      //
      plugin.login(
          getMyLoginId(), password.getText(), getContactList(), MessagingNetwork.STATUS_ONLINE);
      logoutBtn.setEnabled(true);
    } catch (Throwable tr) {
      printException(tr);
      boolean loggedIn = false;
      try {
        loggedIn = plugin.getClientStatus(getMyLoginId()) != MessagingNetwork.STATUS_OFFLINE;
      } catch (Throwable tr2) {
        printException(tr2);
      }
      if (!loggedIn) {
        enableLoginUI();
      }
    }
  }
  public void init() {
    try {
      // data init
      loginId.setText("" + cfg.REQPARAM_SRC_LOGIN_ID);
      password.setText("" + cfg.REQPARAM_SRC_PASSWORD);

      // ui init
      setLayout(new GridLayout(2, 1));
      Panel inputArea = new Panel(new BorderLayout(2, 2));
      inputArea.add(contactList, "Center");
      Panel bottomR = new Panel(new FlowLayout(FlowLayout.RIGHT));
      bottomR.add(loginBtn);
      bottomR.add(logoutBtn);
      bottomR.add(closeBtn);
      Panel bottomL = new Panel(new FlowLayout());
      bottomL.add(new Label("status:"));
      bottomL.add(clientStatus);
      bottomL.add(new Label("  contact:"));
      bottomL.add(contactListEntry);
      bottomL.add(addToContactList);
      bottomL.add(removeFromContactList);
      bottomL.add(getUserDetailsButton());
      bottomL.add(getSendContactsButton());
      Panel bottom = new Panel(new BorderLayout());
      bottom.add("Center", bottomR);
      bottom.add("West", bottomL);
      inputArea.add(bottom, "South");
      Panel leftTop = new Panel(new GridLayout(10, 1));
      leftTop.add(new Label("login id:")); // 1
      leftTop.add(loginId); // 2
      leftTop.add(new Label("password:"******""));
      leftTop.add(new Label("")); // 6

      leftTop.add(new Label("send msg"));
      leftTop.add(sendMsg); // 8
      leftTop.add(new Label("to"));
      leftTop.add(dstLoginId); // 10

      Panel left = new Panel(new FlowLayout());
      left.add(leftTop);
      inputArea.add(left, "West");
      Panel eventLogPanel = new Panel(new BorderLayout());
      eventLogPanel.add("Center", eventLog);
      Panel eventLogPanelButtons = new Panel(new FlowLayout(FlowLayout.RIGHT));
      eventLogPanelButtons.add(clearEventLogBtn);
      eventLogPanel.add("South", eventLogPanelButtons);
      add(inputArea);
      add(eventLogPanel);
      setBackground(SystemColor.control);
      doLayout();
      sendMsg.requestFocus();
    } catch (Throwable tr) {
      CAT.error("exception", tr);
      System.exit(1);
    }
  }
 /** Initializes the controller class. */
 @Override
 public void initialize(URL url, ResourceBundle rb) {
   logger.entry();
   OkButton.disableProperty()
       .bind(
           Bindings.isEmpty(FederationExecutionName.textProperty())
               .or(Bindings.isEmpty(FederateType.textProperty())));
   logger.exit();
 }
 void enableLoginUI() {
   try {
     logoutBtn.setEnabled(false);
     contactList.setEditable(true);
     loginBtn.setEnabled(true);
     loginId.setEnabled(true);
     password.setEnabled(true);
   } catch (Throwable tr) {
     CAT.error("exception", tr);
   }
 }
Esempio n. 6
0
 // Close socket and IO streams, change appearance/functionality of some components
 private void closeAll() throws IOException {
   displayArea.append("\nConnection closing");
   output.close();
   input.close();
   connection.close();
   // We are no longer connected
   connection = null;
   // Change components
   serverField.setEditable(true);
   connectButton.setLabel("Connect to server above");
   enterField.setEnabled(false);
 }
Esempio n. 7
0
  // we define the method for getting a video link when pressing enter
  public String getvidlink() {
    try {
      System.setSecurityManager(new SecurityManager());

      ipadd = tfIP.getText();
      Interface client = (Interface) Naming.lookup("rmi://" + ipadd + "/getvid");

      // Get the String entered into the TextField tfInput, convert to int
      link = tfInput.getText();
      vlink = client.getvid(link);

    } catch (Exception e) {
      System.out.println("[System] Server failed: " + e);
    }
    return vlink;
  }
Esempio n. 8
0
  public void newFile() {
    infoTa.setText("");
    selectProviderCb.setValue(providers.get(0).getName());
    weightTf.setText("0.0");

    for (Entry<String, TextField> entry : propertiesTf.entrySet()) {
      String propertyName = entry.getKey();
      TextField tf = entry.getValue();
      CheckBox cb = propertiesCb.get(propertyName);

      tf.setText("0.0");
      tf.setDisable(true);
      cb.setSelected(false);
    }

    file = null;
    mainStage.setTitle("unknown");
  }
Esempio n. 9
0
 public void commandAction(Command comm, Displayable disp) {
   if (comm == confirm) {
     currentName = inputItem.getString();
     if (currentName == null || currentName.equals("")) currentName = "Anonym";
     check4newHighScore(points, level);
     menu.show(menu);
   } else if (comm == abort) ;
   menu.show(menu);
 }
 {
   ActionListener al =
       new ActionListener() {
         public void actionPerformed(ActionEvent ev) {
           if (!(StringUtil.isNullOrTrimmedEmpty(dstLoginId.getText()))
               && !(StringUtil.isNullOrTrimmedEmpty(sendMsg.getText()))) {
             try {
               plugin.sendMessage(getMyLoginId(), dstLoginId.getText(), sendMsg.getText());
               sendMsg.setText("msg " + Math.random());
             } catch (Throwable tr) {
               printException(tr);
             }
           }
         }
       };
   sendMsg.selectAll();
   sendMsg.addActionListener(al);
   dstLoginId.addActionListener(al);
 }
Esempio n. 11
0
  public void startRecording() {
    statusLabel.setText("Status: Recording...");
    statusLabel.setFont(new Font("Helvetica", Font.BOLD, 12));
    statusLabel.setForeground(Color.red);
    recordButton.setLabel("Stop recording");

    recording = true;

    viewer.setRecordingStatus(fnameField.getText());
  }
Esempio n. 12
0
  public void actionPerformed(ActionEvent evt) {
    if (evt.getSource() == browseButton) {
      if (browseFile() && recording) startRecording();

    } else if (evt.getSource() == recordButton) {
      if (!recording) {
        startRecording();
      } else {
        stopRecording();
        fnameField.setText(nextNewFilename(fnameField.getText()));
      }

    } else if (evt.getSource() == nextButton) {
      fnameField.setText(nextNewFilename(fnameField.getText()));
      if (recording) startRecording();

    } else if (evt.getSource() == closeButton) {
      setVisible(false);
    }
  }
 void fetchUserDetails() {
   try {
     UserDetails d = plugin.getUserDetails(getMyLoginId(), contactListEntry.getText());
     String s =
         getMyLoginId()
             + " reports: user details for "
             + contactListEntry.getText()
             + " are:\r\n  nick="
             + StringUtil.toPrintableString(d.getNick())
             + ",\r\n  real name="
             + StringUtil.toPrintableString(d.getRealName())
             + ",\r\n  email="
             + StringUtil.toPrintableString(d.getEmail())
             + ".";
     CAT.info(s);
     log(s);
   } catch (Exception ex) {
     printException(ex);
   }
 }
Esempio n. 14
0
 public CipherChatClient() {
   super("Cipher Chat Client");
   // Establish keys for RSA cipher
   makeKeys();
   // Lay out the components and display the frame
   setLayout(new GridLayout(2, 1));
   top.setLayout(new GridLayout(3, 1));
   add(top);
   bottom.setLayout(new GridLayout(1, 1));
   add(bottom);
   connectButton.addActionListener(this);
   enterField.setEnabled(false);
   enterField.addActionListener(this);
   top.add(serverField);
   top.add(connectButton);
   top.add(enterField);
   bottom.add(displayArea);
   setSize(400, 300);
   show();
 }
Esempio n. 15
0
  protected boolean browseFile() {
    File currentFile = new File(fnameField.getText());

    FileDialog fd = new FileDialog(this, "Save next session as...", FileDialog.SAVE);
    fd.setDirectory(currentFile.getParent());
    fd.setVisible(true);
    if (fd.getFile() != null) {
      String newDir = fd.getDirectory();
      String sep = System.getProperty("file.separator");
      if (newDir.length() > 0) {
        if (!sep.equals(newDir.substring(newDir.length() - sep.length()))) newDir += sep;
      }
      String newFname = newDir + fd.getFile();
      if (newFname.equals(fnameField.getText())) {
        fnameField.setText(newFname);
        return true;
      }
    }
    return false;
  }
Esempio n. 16
0
  public void open(File f) {
    Properties open = new Properties();
    InputStream input = null;

    try {
      input = new FileInputStream(f);
      open.load(input);

      selectProviderCb.setValue(open.getProperty("provider"));
      selectGrainCb.setValue(open.getProperty("grain"));
      weightTf.setText(open.getProperty("weight"));
      infoTa.setText(open.getProperty("info"));

      for (Entry<String, TextField> entry : propertiesTf.entrySet()) {
        String propertyName = entry.getKey();
        TextField tf = entry.getValue();
        CheckBox cb = propertiesCb.get(propertyName);

        tf.setText(open.getProperty(propertyName));
        if (open.getProperty(propertyName + "_ENABLED").equals("ON")) {
          tf.setDisable(false);
          cb.setSelected(true);
        } else {
          tf.setDisable(true);
          cb.setSelected(false);
        }
      }

      mainStage.setTitle(f.getName());
    } catch (Exception ex) {
      infoTa.setText("Не могу открыть файл");
    } finally {
      if (input != null) {
        try {
          input.close();
        } catch (IOException e) {
          e.printStackTrace();
        }
      }
    }
  }
Esempio n. 17
0
  // we define the method for downloading when pressing on the download button
  public void qrvidlink() {
    try {
      System.setSecurityManager(new SecurityManager());

      ipadd = tfIP.getText();
      Interface client = (Interface) Naming.lookup("rmi://" + ipadd + "/getvid");

      // Get the String entered into the TextField tfInput, convert to int
      link = tfInput.getText();
      vlink = client.getvid(link);

      // here we receive the image serialized into bytes from the server and
      // saved it on the client as png image
      byte[] bytimg = client.qrvid(vlink);
      BufferedImage img = ImageIO.read(new ByteArrayInputStream(bytimg));
      File outputfile = new File("qrcode.png");
      ImageIO.write(img, "png", outputfile);

      // img= new ImageIcon(bytimg.toByteArray());
    } catch (Exception e) {
      System.out.println("[System] Server failed: " + e);
    }
  }
Esempio n. 18
0
  public void save(File f) {
    Properties save = new Properties();
    OutputStream output = null;

    try {
      save.setProperty("provider", selectProviderCb.getValue());
      save.setProperty("grain", selectGrainCb.getValue());
      save.setProperty("weight", weightTf.getText());
      save.setProperty("info", infoTa.getText());

      for (Entry<String, TextField> entry : propertiesTf.entrySet()) {
        TextField tf = entry.getValue();
        String propertyName = entry.getKey();

        save.setProperty(propertyName, tf.getText());
        if (tf.isDisable()) {
          save.setProperty(propertyName + "_ENABLED", "OFF");
        } else {
          save.setProperty(propertyName + "_ENABLED", "ON");
        }
      }

      output = new FileOutputStream(f);
      save.store(output, null);
      mainStage.setTitle(f.getName());
    } catch (Exception ex) {
      infoTa.setText("Не могу сохранить в файл");
    } finally {
      if (output != null) {
        try {
          output.close();
        } catch (IOException e) {
          e.printStackTrace();
        }
      }
    }
  }
 public void updateStats() {
   // This just updates any statistics that are shown on the face of
   // the server window
   stats.setText(
       server.strings.get(thisClass, "connectionscurrent")
           + " "
           + server.currentConnections
           + "  "
           + server.strings.get(thisClass, "connectionspeak")
           + " "
           + server.peakConnections
           + "  "
           + server.strings.get(thisClass, "connectionstotal")
           + " "
           + server.totalConnections);
   return;
 }
Esempio n. 20
0
 public void launchFrame() {
   setLocation(500, 200);
   this.setSize(100, 100);
   add(tfTxt, BorderLayout.SOUTH);
   add(taContent, BorderLayout.NORTH);
   pack();
   this.addWindowListener(
       new WindowAdapter() {
         public void windowClosing(WindowEvent e) {
           disconnect();
           System.exit(0);
         }
       });
   tfTxt.addActionListener(new TFListener());
   setVisible(true);
   connect();
 }
Esempio n. 21
0
  /** Action listener for the Buttons. */
  public void actionPerformed(ActionEvent e) {
    String cmd = e.getActionCommand();
    if (cmd.equals("ok")) {
      Truline.userProps.put("RecencyDays", recency.getText());
      Truline.userProps.put("MaxDays", maxdays.getText());
      Truline.userProps.put("MaxVariant", maxvariant.getText());
      Truline.userProps.put("UseMaiden", maiden.getText());
      Truline.userProps.put("BetFactorVersion", betFactorVersion.getText());
      Truline.userProps.put("DATADIR", datadir.getText());
      Truline.userProps.put("FontSize", fontsize.getText());
      Truline.userProps.put("PrintProgram", printProgram.getText());
      // Truline.userProps.put("Shell", shell.getText());

      try {
        FileOutputStream out = new FileOutputStream("c:/truline2012/truline.ini");
        if (Truline.userProps.getProperty("TL2013", "N").equals("Yes"))
          Truline.userProps.store(out, "Truline2013 configuration");
        else Truline.userProps.store(out, "Truline2012 configuration");
      } catch (Exception ef) {
      }

      // Make it affective
      m_gui.clear();
      if (Truline.userProps.getProperty("DATATYPE", "DRF").equals("MCP")) {
        for (Enumeration el = m_gui.m_brisMCP.m_races.elements(); el.hasMoreElements(); ) {
          Race race = (Race) el.nextElement();
          Handicap.compute(race);
        }
        GUIReport rpt4 = new GUIReport();
        rpt4.generate(m_gui.m_filename, m_gui.m_brisMCP, m_gui, m_gui.m_raceNbr);
      } else {
        for (Enumeration el = m_gui.m_bris.m_races.elements(); el.hasMoreElements(); ) {
          Race race = (Race) el.nextElement();
          Handicap.compute(race);
        }
        GUIReport rpt4 = new GUIReport();
        rpt4.generate(m_gui.m_filename, m_gui.m_bris, m_gui, m_gui.m_raceNbr);
      }
      dispose();
    } else if (cmd.equals("cancel")) {
      dispose();
    }
  }
Esempio n. 22
0
 public void actionPerformed(ActionEvent e) {
   beta = Double.parseDouble(betaval.getText());
   updatebeta();
   if (e.getSource() == fitavgbutton) {
     fitavg();
   }
   if (e.getSource() == fitglobalbutton) {
     fitglobal();
   }
   if (e.getSource() == clearparamsbutton) {
     resetparams();
   }
   if (e.getSource() == undobutton) {
     undoglobalfit();
   }
   if (e.getSource() == geterrorsbutton) {
     geterrors();
   }
 }
  void sendContacts() {
    try {
      int n = (int) (7 * Math.random());
      if (n < 1) n = 2;

      String[] nicks = new String[n];
      String[] loginIds = new String[n];

      int i = 0;
      while (i < n) {
        nicks[i] = "random uin #" + i;
        loginIds[i] = "" + (22222 + (int) (10000000 * Math.random()));
        i++;
      }
      plugin.sendContacts(getMyLoginId(), contactListEntry.getText(), nicks, loginIds);
    } catch (Exception ex) {
      printException(ex);
    }
  }
 private void startSession() {
   SipClientConnection scc = null;
   try {
     // <i><b>start a listener for incoming requests</b></i>
     startListener();
     // <i><b>open SIP connection with remote user</b></i>
     scc = (SipClientConnection) Connector.open(address.getString());
     scc.setListener(this);
     // <i><b>initialize INVITE request</b></i>
     scc.initRequest("INVITE", scn);
     scc.setHeader("Content-Length", "" + sdp.length());
     scc.setHeader("Content-Type", "application/sdp");
     OutputStream os = scc.openContentOutputStream();
     os.write(sdp.getBytes());
     os.close(); // <i><b>close and send</b></i>
     str = new StringItem("Inviting... ", scc.getHeader("To"));
     form.append(str);
   } catch (Exception ex) {
     ex.printStackTrace();
     // <i><b>handle IOException</b></i>
   }
 }
Esempio n. 25
0
 public void itemStateChanged(ItemEvent e) {
   beta = Double.parseDouble(betaval.getText());
   updatebeta();
   boolean avgchanged = false;
   for (int i = 0; i < ncurves; i++) {
     if (checkarray[i].getState() != include[i]) {
       avgchanged = true;
       if (include[i]) {
         include[i] = false;
       } else {
         include[i] = true;
       }
     }
   }
   if (avgchanged) {
     updateavg();
     updatebeta();
     int1array[ncurves].setText("" + (float) intensity1[ncurves]);
     e1array[ncurves].setText("" + (float) bright1[ncurves]);
     n1array[ncurves].setText("" + (float) number1[ncurves]);
     int2array[ncurves].setText("" + (float) intensity2[ncurves]);
     e2array[ncurves].setText("" + (float) bright2[ncurves]);
     n2array[ncurves].setText("" + (float) number2[ncurves]);
     eccarray[ncurves].setText("" + (float) brightcc[ncurves]);
     pwavg.updateSeries(avg, 0, true);
     float[] temp = pwavg.getLimits();
     temp[4] = 1.0f;
     pwavg.setLimits(temp);
   }
   if (e.getSource() == dispcurvechoice) {
     dispcurve = dispcurvechoice.getSelectedIndex();
     pwfit.updateSeries(pch[dispcurve], 0, true);
     pwfit.updateSeries(fit[dispcurve], 1, true);
     float[] temp = pwfit.getLimits();
     temp[4] = 1.0f;
     pwfit.setLimits(temp);
   }
 }
Esempio n. 26
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();
  }
  public babylonServerWindow(babylonServer parent, String Name) {
    super(Name);
    server = parent;

    myLayout = new GridBagLayout();
    setLayout(myLayout);

    p = new Panel();
    p.setLayout(myLayout);

    listening = new Label(server.strings.get(thisClass, "listenport") + " " + server.port);
    p.add(
        listening,
        new babylonConstraints(
            0,
            0,
            1,
            1,
            0.0,
            0.0,
            GridBagConstraints.NORTHWEST,
            GridBagConstraints.NONE,
            new Insets(0, 0, 0, 0),
            0,
            0));

    logChat = new Checkbox(server.strings.get(thisClass, "logchats"), server.logChats);
    logChat.addItemListener(this);
    p.add(
        logChat,
        new babylonConstraints(
            1,
            0,
            1,
            1,
            1.0,
            1.0,
            GridBagConstraints.NORTHWEST,
            GridBagConstraints.NONE,
            new Insets(0, 0, 0, 0),
            0,
            0));

    userList = new List(4, false);
    userList.addItemListener(this);
    p.add(
        userList,
        new babylonConstraints(
            0,
            1,
            1,
            5,
            1.0,
            1.0,
            GridBagConstraints.NORTHWEST,
            GridBagConstraints.BOTH,
            new Insets(0, 0, 5, 0),
            0,
            0));

    userAdmin = new Button(server.strings.get(thisClass, "usermanagement"));
    userAdmin.addActionListener(this);
    p.add(
        userAdmin,
        new babylonConstraints(
            1,
            1,
            1,
            1,
            1.0,
            1.0,
            GridBagConstraints.NORTHWEST,
            GridBagConstraints.HORIZONTAL,
            new Insets(0, 0, 0, 0),
            0,
            0));

    console = new Button(server.strings.get(thisClass, "adminclient"));
    console.addActionListener(this);
    p.add(
        console,
        new babylonConstraints(
            1,
            2,
            1,
            1,
            1.0,
            1.0,
            GridBagConstraints.NORTHWEST,
            GridBagConstraints.HORIZONTAL,
            new Insets(0, 0, 0, 0),
            0,
            0));

    disconnect = new Button(server.strings.get(thisClass, "disconnectuser"));
    disconnect.setEnabled(false);
    disconnect.addActionListener(this);
    p.add(
        disconnect,
        new babylonConstraints(
            1,
            3,
            1,
            1,
            1.0,
            1.0,
            GridBagConstraints.NORTHWEST,
            GridBagConstraints.HORIZONTAL,
            new Insets(0, 0, 0, 0),
            0,
            0));

    disconnectAll = new Button(server.strings.get(thisClass, "disconnectall"));
    disconnectAll.setEnabled(false);
    disconnectAll.addActionListener(this);
    p.add(
        disconnectAll,
        new babylonConstraints(
            1,
            4,
            1,
            1,
            1.0,
            1.0,
            GridBagConstraints.NORTHWEST,
            GridBagConstraints.HORIZONTAL,
            new Insets(0, 0, 0, 0),
            0,
            0));

    shutdown = new Button(server.strings.get(thisClass, "shutdown"));
    shutdown.addActionListener(this);
    p.add(
        shutdown,
        new babylonConstraints(
            1,
            5,
            1,
            1,
            1.0,
            1.0,
            GridBagConstraints.NORTHWEST,
            GridBagConstraints.HORIZONTAL,
            new Insets(0, 0, 0, 0),
            0,
            0));

    stats =
        new TextField(
            server.strings.get(thisClass, "connectionscurrent")
                + " 0  "
                + server.strings.get(thisClass, "connectionspeak")
                + " 0  "
                + server.strings.get(thisClass, "connectionstotal")
                + " 0",
            40);
    stats.setEditable(false);
    p.add(
        stats,
        new babylonConstraints(
            0,
            7,
            2,
            1,
            1.0,
            1.0,
            GridBagConstraints.NORTHWEST,
            GridBagConstraints.BOTH,
            new Insets(0, 0, 0, 0),
            0,
            0));

    logWindow =
        new TextArea(
            server.strings.get(thisClass, "activitylog") + "\n",
            10,
            40,
            TextArea.SCROLLBARS_VERTICAL_ONLY);
    logWindow.setEditable(false);
    p.add(
        logWindow,
        new babylonConstraints(
            0,
            8,
            2,
            1,
            1.0,
            1.0,
            GridBagConstraints.NORTHWEST,
            GridBagConstraints.BOTH,
            new Insets(0, 0, 5, 0),
            0,
            0));

    canvas = new babylonPictureCanvas(this);
    p.add(
        canvas,
        new babylonConstraints(
            0,
            9,
            2,
            1,
            1.0,
            1.0,
            GridBagConstraints.NORTHWEST,
            GridBagConstraints.BOTH,
            new Insets(0, 0, 0, 0),
            0,
            0));

    add(
        p,
        new babylonConstraints(
            0,
            0,
            1,
            1,
            1.0,
            1.0,
            GridBagConstraints.NORTHWEST,
            GridBagConstraints.BOTH,
            new Insets(5, 5, 5, 5),
            0,
            0));

    try {
      URL url = new URL("file", "localhost", "babylonPic.jpg");
      Image image = getToolkit().getImage(url);

      canvas.setimage(image);
    } catch (Exception e) {
      System.out.println(e);
    }

    try {
      URL iconUrl = new URL("file", "localhost", "babylonIcon.jpg");
      ImageIcon icon = new ImageIcon(iconUrl);
      this.setIconImage(icon.getImage());
    } catch (Exception e) {
      /* Not important */
    }

    addWindowListener(this);

    setSize(600, 600);
    pack();
  }
Esempio n. 28
0
  RecordingFrame(VncViewer v) {
    super("Teambox Screen Sharing Session Recording");

    viewer = v;

    // Determine initial filename for next saved session.
    // FIXME: Check SecurityManager.

    String fname =
        nextNewFilename(
            System.getProperty("user.dir")
                + System.getProperty("file.separator")
                + "vncsession.fbs");

    // Construct new panel with file name field and "Browse" button.

    Panel fnamePanel = new Panel();
    GridBagLayout fnameGridbag = new GridBagLayout();
    fnamePanel.setLayout(fnameGridbag);

    GridBagConstraints fnameConstraints = new GridBagConstraints();
    fnameConstraints.gridwidth = GridBagConstraints.RELATIVE;
    fnameConstraints.fill = GridBagConstraints.BOTH;
    fnameConstraints.weightx = 4.0;

    fnameField = new TextField(fname, 64);
    fnameGridbag.setConstraints(fnameField, fnameConstraints);
    fnamePanel.add(fnameField);
    fnameField.addActionListener(this);

    fnameConstraints.gridwidth = GridBagConstraints.REMAINDER;
    fnameConstraints.weightx = 1.0;

    browseButton = new Button("Browse");
    fnameGridbag.setConstraints(browseButton, fnameConstraints);
    fnamePanel.add(browseButton);
    browseButton.addActionListener(this);

    // Construct the frame.

    GridBagLayout gridbag = new GridBagLayout();
    setLayout(gridbag);

    GridBagConstraints gbc = new GridBagConstraints();
    gbc.gridwidth = GridBagConstraints.REMAINDER;
    gbc.fill = GridBagConstraints.BOTH;
    gbc.weighty = 1.0;
    gbc.insets = new Insets(10, 0, 0, 0);

    Label helpLabel = new Label("File name to save next recorded session in:", Label.CENTER);
    gridbag.setConstraints(helpLabel, gbc);
    add(helpLabel);

    gbc.fill = GridBagConstraints.HORIZONTAL;
    gbc.weighty = 0.0;
    gbc.insets = new Insets(0, 0, 0, 0);

    gridbag.setConstraints(fnamePanel, gbc);
    add(fnamePanel);

    gbc.fill = GridBagConstraints.BOTH;
    gbc.weighty = 1.0;
    gbc.insets = new Insets(10, 0, 10, 0);

    statusLabel = new Label("", Label.CENTER);
    gridbag.setConstraints(statusLabel, gbc);
    add(statusLabel);

    gbc.fill = GridBagConstraints.HORIZONTAL;
    gbc.weightx = 1.0;
    gbc.weighty = 0.0;
    gbc.gridwidth = 1;
    gbc.insets = new Insets(0, 0, 0, 0);

    recordButton = new Button("Record");
    gridbag.setConstraints(recordButton, gbc);
    add(recordButton);
    recordButton.addActionListener(this);

    nextButton = new Button("Next file");
    gridbag.setConstraints(nextButton, gbc);
    add(nextButton);
    nextButton.addActionListener(this);

    closeButton = new Button("Close");
    gridbag.setConstraints(closeButton, gbc);
    add(closeButton);
    closeButton.addActionListener(this);

    // Set correct text, font and color for the statusLabel.
    stopRecording();

    pack();

    addWindowListener(this);
  }
 {
   password.setEchoChar('*');
 }
 String getMyLoginId() {
   return loginId.getText();
 }