public void actionPerformed(ActionEvent evt) {
    Object src = evt.getSource();

    try {
      if (src == propDialog) {
        propDialog_actionPerformed(evt);
      } else {
        pdu = new BlockPdu(context);
        if (src == setButton) {
          pdu.setPduType(BlockPdu.SET);
          pdu.addOid(toid.getText(), new AsnOctets(tvalue.getText()));
        } else if (src == getButton) {
          pdu.setPduType(BlockPdu.GET);
          pdu.addOid(toid.getText());
        } else if (src == getNextButton) {
          pdu.setPduType(BlockPdu.GETNEXT);
          pdu.addOid(toid.getText());
        }
        sendRequest(pdu);
      }
    } catch (Exception exc) {
      exc.printStackTrace();
      lmessage.setText("Exception: " + exc.getMessage());
      lmessage.setBackground(Color.red);
    }
  }
  private void eqtnChanged() {
    if (updating) {
      return;
    }

    if (respProjs == null || metricsData == null) {
      return;
    }

    if (!EquationHelpers.validateEquationSuccess(variablesLst, equationField.getText())) {
      return;
    }

    updating = true;

    Benchmark.PredictionMethods predMethods =
        new PredictionMethodsFromString(equationField.getText());

    try {
      Benchmark.Quality q =
          Benchmark.runBenchmark(
              predMethods, metricsData, respProjs, zeroIsInvalidCheckbox.isSelected());

      int ncorr;
      double wncorr;
      int napplicable;
      double nwapplicable;
      switch (mode) {
        default:
        case TestEffort:
          ncorr = q.teCorrect;
          wncorr = q.teWeightedCorrect;
          napplicable = q.numTeApplicable;
          nwapplicable = q.numTeWeightedApplicable;
          break;
        case BugCount:
          ncorr = q.bcCorrect;
          wncorr = q.bcWeightedCorrect;
          napplicable = q.numBcApplicable;
          nwapplicable = q.numBcWeightedApplicable;
          break;
      }

      numCorrLbl.setText("" + ncorr);
      weightedNumCorrLbl.setText("" + wncorr);
      percCorrLbl.setText(
          String.format("%.2f", (double) ncorr / (double) napplicable * 100.0) + "%");
      percWeightCorrLbl.setText(String.format("%.2f", wncorr / nwapplicable * 100.0) + "%");

      weightSumLbl.setText("" + nwapplicable);
      numEstimationsLbl.setText("" + napplicable);

      updateTable(q);

    } catch (Exception e) {
      e.printStackTrace();
    }

    updating = false;
  }
Example #3
0
  private String consultar(
      String elemento) // Se busca si existe y manda el resultado (Nombre o Clave)
      {
    boolean vacia = lista.vacia();

    if (elemento.equals("MARCA")) {
      marca = tfMarca.getText();

      if (marca.equals("")) resultado = "MARCA_VACIA";
      if (vacia == true) resultado = "LISTA_VACIA";

      if ((!marca.equals("")) && (vacia == false)) resultado = lista.consultarMarca(marca);
    }

    if (elemento.equals("CLAVE")) {
      clave = tfClave.getText();

      if (clave.equals("")) resultado = "CLAVE_VACIA";
      if (vacia == true) resultado = "LISTA_VACIA";

      if ((!clave.equals("")) && (vacia == false)) resultado = lista.consultarClave(clave);
    }

    if (elemento.equals("CLAVE_CAPTURAR")) {
      clave = tfClave.getText();
      resultado = lista.consultarClave(clave);
      if (resultado.equals("LISTA_VACIA")) resultado = "CLAVE_NO_ENCONTRADA";
    }

    return resultado;
  }
  private void addItem() {
    if (!searchName.getText().isEmpty() && !item.getText().isEmpty()) {

      try {
        Main.setItem(
            searchName.getText(),
            "http://www.reddit.com/r/hardwareswap/search?q="
                + item.getText()
                + "&sort=new&restrict_sr=on");

        results.setText("Current Items");

        displayInformation();

      } catch (IOException e1) {
        e1.printStackTrace();
      }

      searchName.setText("");
      item.setText("");

    } else {

      results.setText("Please provide all info for Item Name, Keyword, and Website");
    }
  }
Example #5
0
 public void actionPerformed(ActionEvent event) {
   if (event.getSource() == joinButton) {
     if (joinButton.isSelected()) {
       mThread =
           new MulticastThread(
               Integer.valueOf(portField.getText()), chatIPField.getText(), chatroomArea, true);
       (new Thread(mThread)).start();
     }
   }
   if (event.getSource() == sendButton) {
     mThread.send(usernameField.getText(), chatMsgField.getText());
     chatMsgField.setText("");
   }
   if (event.getSource() == leaveButton) {
     try {
       joinButton.setSelected(false);
       mThread.leave();
       System.out.println("Disconnected from chat ");
     } catch (Exception e) {
     }
   }
   if (event.getSource() == exitButton) {
     System.exit(0);
   }
 }
Example #6
0
  public boolean checkSettings() {
    if (!new File(downloadDirectoryTextField.getText()).exists()) {
      JOptionPane.showMessageDialog(
          this,
          I18n.getLocaleString("INVALID_DOWNLOAD_DIRECTORY"),
          I18n.getLocaleString("ERROR"),
          JOptionPane.ERROR_MESSAGE);
      return false;
    }

    if (!Groovesquid.getDownloadService()
        .getFilenameSchemeParser()
        .validateFilenameScheme(fileNameSchemeTextField.getText())) {
      JOptionPane.showMessageDialog(
          this,
          I18n.getLocaleString("INVALID_FILENAME_SCHEME"),
          I18n.getLocaleString("ERROR"),
          JOptionPane.ERROR_MESSAGE);
      return false;
    }

    return !((downloadCompletedComboBox.getSelectedIndex()
                == Config.DownloadComplete.ADD_ITUNES.ordinal()
            || downloadCompletedComboBox.getSelectedIndex()
                == Config.DownloadComplete.ADD_ITUNES_REMOVE.ordinal())
        && !GuiUtils.getSystem().equals(GuiUtils.OperatingSystem.MAC));
  }
Example #7
0
  // Invoked when <Enter> is pressed
  public void actionPerformed(ActionEvent e) {
    FCConverter fc = new FCConverter();

    if ((JTextField) e.getSource() == displayF) {
      // Fahrenheit to Celsius
      double degrees = stringToDouble(displayF.getText());
      if (!Double.isNaN(degrees)) {
        fc.setFahrenheit(degrees);
        degrees = fc.getCelsius();
        displayC.setText(String.format("%1.1f", degrees));
      } else {
        displayF.selectAll();
      }
    } else {
      // Celsius to Fahrenheit
      double degrees = stringToDouble(displayC.getText());
      if (!Double.isNaN(degrees)) {
        fc.setCelsius(degrees);
        degrees = fc.getFahrenheit();
        displayF.setText(String.format("%1.1f", degrees));
      } else {
        displayC.selectAll();
      }
    }
  }
 public void actionPerformed(ActionEvent e) {
   Object jbX = e.getSource();
   if (jbX == jbReg) {
     String an = tfKnygosNr.getText();
     if (rg.registruotiKnygas(an)) {
       RodytiKnyguRinkinius();
     } else
       JOptionPane.showMessageDialog(
           this,
           "Registracija neįvyko:\n" + "arba kartojasi auto numeris arba nėra neregistruotų");
   }
   if (jbX == jbSkaityti) {
     rg.neregKnygos.clear();
     String ats = rg.skaitytiKnygas("Books.book");
     JOptionPane.showMessageDialog(this, ats);
     RodytiKnyguRinkinius();
   }
   if (jbX == jbSaveObj) {
     saveObject(rg, "Knygos1.obj");
   }
   if (jbX == jbLoadObj) {
     rg = (KnyguRegistracija) loadObject("Knygos1.obj");
     RodytiKnyguRinkinius();
   }
   if (jbX == jbAtranka) {
     String pag = tfKnygosNr.getText();
     Book a = rg.regKnygos.get(pag);
     pag += a == null ? " knyga nerasta" : "=" + a;
     JOptionPane.showMessageDialog(this, pag);
     ;
   }
 }
  protected void doOKAction() {
    final LogicalPosition currentPosition = myEditor.getCaretModel().getLogicalPosition();
    int lineNumber = getLineNumber(currentPosition.line + 1);
    if (isInternal() && myOffsetField.getText().length() > 0) {
      try {
        final int offset = Integer.parseInt(myOffsetField.getText());
        if (offset < myEditor.getDocument().getTextLength()) {
          myEditor.getCaretModel().removeSecondaryCarets();
          myEditor.getCaretModel().moveToOffset(offset);
          myEditor.getScrollingModel().scrollToCaret(ScrollType.CENTER);
          myEditor.getSelectionModel().removeSelection();
          IdeFocusManager.getGlobalInstance().requestFocus(myEditor.getContentComponent(), true);
          super.doOKAction();
        }
        return;
      } catch (NumberFormatException e) {
        return;
      }
    }

    if (lineNumber < 0) return;

    int columnNumber = getColumnNumber(currentPosition.column);
    myEditor.getCaretModel().removeSecondaryCarets();
    myEditor
        .getCaretModel()
        .moveToLogicalPosition(
            new LogicalPosition(Math.max(0, lineNumber - 1), Math.max(0, columnNumber - 1)));
    myEditor.getScrollingModel().scrollToCaret(ScrollType.CENTER);
    myEditor.getSelectionModel().removeSelection();
    IdeFocusManager.getGlobalInstance().requestFocus(myEditor.getContentComponent(), true);
    super.doOKAction();
  }
Example #10
0
 @Override
 public void keyTyped(KeyEvent ke) {
   if (ke.getSource() == jtxtCodigo) {
     char c;
     // capturar el caracter digitado
     c = ke.getKeyChar();
     if (jtxtCodigo.getText().length() >= 5
         || (c < '0' || c > '9')
             && (c != (char) KeyEvent.VK_BACK_SPACE)
             && (c != (char) KeyEvent.VK_DELETE)) {
       ke.consume(); // ignora el caracter digitado
       Toolkit.getDefaultToolkit().beep();
     }
   }
   if (ke.getSource() == jtxtPrecio) {
     char c;
     // capturar el caracter digitado
     c = ke.getKeyChar();
     if (jtxtPrecio.getText().length() >= 10
         || (c < '0' || c > '9')
             && (c < 'a' || c > 'z')
             && (c < 'A' || c > 'Z')
             && (c != (char) KeyEvent.VK_BACK_SPACE)
             && (c != (char) KeyEvent.VK_DELETE)) {
       ke.consume(); // ignora el caracter digitado
       Toolkit.getDefaultToolkit().beep();
     }
   }
 }
  public void propertyChange(PropertyChangeEvent e) {
    String prop = e.getPropertyName();

    if (isVisible()
        && (e.getSource() == optionPane)
        && (JOptionPane.VALUE_PROPERTY.equals(prop)
            || JOptionPane.INPUT_VALUE_PROPERTY.equals(prop))) {
      Object value = optionPane.getValue();

      if (value == JOptionPane.UNINITIALIZED_VALUE) return;
      optionPane.setValue(JOptionPane.UNINITIALIZED_VALUE);

      if (button1.equals(value)) {
        try {
          double a = Double.parseDouble(left.getText());
          double b = Double.parseDouble(right.getText());
          double err = Double.parseDouble(error.getText());

          if (a > b) {
            JOptionPane.showMessageDialog(this, "A < B!!!", null, JOptionPane.ERROR_MESSAGE);
          } else {
            hideIt();
            graphic.startApplyingMethod(parentFrame.getSelectedMethod(), err, a, b);
          }
        } catch (Exception ex) {
          JOptionPane.showMessageDialog(
              this, "Trebuie sa fie numar real!", null, JOptionPane.ERROR_MESSAGE);
        }
      } else if (button2.equals(value)) {
        hideIt();
      }
    }
  }
 void jTextFieldSendMessages_keyPressed(KeyEvent e) {
   if (e.getKeyCode() == e.VK_DOWN) {
     String s = msgHistory.forward();
     if (s != null) {
       jTextFieldSendMessages.setText(s);
     }
   } else if (e.getKeyCode() == e.VK_UP) {
     String s = msgHistory.back();
     if (s != null) {
       jTextFieldSendMessages.setText(s);
     }
   } else if (e.getKeyChar() == '\n') {
     String body = jTextFieldSendMessages.getText();
     if (body.length() > 0) {
       if (body.charAt(body.length() - 1) == '\n') body = body.substring(0, body.length() - 1);
       String subject = jTextFieldSendSubject.getText();
       if (subject.length() > 0) {
         if (subject.charAt(subject.length() - 1) == '\n')
           subject = subject.substring(0, subject.length() - 1);
       }
       if (session != null && session.isConnected()) {
         session.postMessage(jTextFieldTargetUser.getText(), subject, body);
         displaySendMessage(subject, jTextFieldTargetUser.getText(), body, outgoingMsgAttrSet);
       }
       msgHistory.add(body);
       subjectHistory.add(subject);
       subjectHistory.reset();
       msgHistory.reset();
       jTextFieldSendMessages.setText("");
       jTextFieldSendSubject.setText("");
     }
   }
 }
Example #13
0
  @Override
  public void actionPerformed(ActionEvent a) {
    JButton button = (JButton) a.getSource();

    if (button.equals(buttonOk)) {
      String url = txUrl.getText();
      String lien = txLien.getText();
      if (url == null || url.length() == 0 || lien == null || lien.length() == 0) {
        Controleur.creerOptionPane("error", "Veuillez entrer toutes les informations");
        return;
      }
      // on recupere le texte de l'editeur
      String texte = panAjoutParagraphe.getJEditorPane().getText();
      String texteFinal = "";

      // on le traite ligne par ligne
      Scanner sc = new Scanner(texte);
      sc.useDelimiter("\n");
      while (sc.hasNext()) {
        String ligne = sc.next();
        // si la ligne contient la balise de fin de paragraphe, on ajoute le lien
        if (ligne.contains("</body>"))
          texteFinal += "<a href=\"" + url + "\">" + lien + "</a>&nbsp;\n";
        else texteFinal += ligne + "\n"; // on ajoute la ligne au texte
      }
      panAjoutParagraphe.getJEditorPane().setText(texteFinal);
    }

    this.dispose();
  }
  /** Returns the ClassMemberSpecification currently represented in this dialog. */
  public ClassMemberSpecification getClassMemberSpecification() {
    String name = nameTextField.getText();
    String type = typeTextField.getText();
    String arguments = argumentsTextField.getText();

    if (name.equals("") || name.equals("*")) {
      name = null;
    }

    if (type.equals("") || type.equals("*")) {
      type = null;
    }

    if (name != null || type != null) {
      if (isField) {
        if (type == null) {
          type = ClassConstants.EXTERNAL_TYPE_INT;
        }

        type = ClassUtil.internalType(type);
      } else {
        if (type == null) {
          type = ClassConstants.EXTERNAL_TYPE_VOID;
        }

        type = ClassUtil.internalMethodDescriptor(type, ListUtil.commaSeparatedList(arguments));
      }
    }

    ClassMemberSpecification classMemberSpecification =
        new ClassMemberSpecification(0, 0, name, type);

    // Also get the access radio button settings.
    getClassMemberSpecificationRadioButtons(
        classMemberSpecification, ClassConstants.INTERNAL_ACC_PUBLIC, publicRadioButtons);
    getClassMemberSpecificationRadioButtons(
        classMemberSpecification, ClassConstants.INTERNAL_ACC_PRIVATE, privateRadioButtons);
    getClassMemberSpecificationRadioButtons(
        classMemberSpecification, ClassConstants.INTERNAL_ACC_PROTECTED, protectedRadioButtons);
    getClassMemberSpecificationRadioButtons(
        classMemberSpecification, ClassConstants.INTERNAL_ACC_STATIC, staticRadioButtons);
    getClassMemberSpecificationRadioButtons(
        classMemberSpecification, ClassConstants.INTERNAL_ACC_FINAL, finalRadioButtons);
    getClassMemberSpecificationRadioButtons(
        classMemberSpecification, ClassConstants.INTERNAL_ACC_VOLATILE, volatileRadioButtons);
    getClassMemberSpecificationRadioButtons(
        classMemberSpecification, ClassConstants.INTERNAL_ACC_TRANSIENT, transientRadioButtons);
    getClassMemberSpecificationRadioButtons(
        classMemberSpecification,
        ClassConstants.INTERNAL_ACC_SYNCHRONIZED,
        synchronizedRadioButtons);
    getClassMemberSpecificationRadioButtons(
        classMemberSpecification, ClassConstants.INTERNAL_ACC_NATIVE, nativeRadioButtons);
    getClassMemberSpecificationRadioButtons(
        classMemberSpecification, ClassConstants.INTERNAL_ACC_ABSTRACT, abstractRadioButtons);
    getClassMemberSpecificationRadioButtons(
        classMemberSpecification, ClassConstants.INTERNAL_ACC_STRICT, strictRadioButtons);

    return classMemberSpecification;
  }
Example #15
0
 private boolean setServiceParameter(
     GlobalEnvironment.PropertyType type, JLabel label, JTextField textField) {
   String name = String.valueOf(type).toLowerCase();
   String startDirectory =
       StringUtil.isEmptyOrSpaces(textField.getText())
           ? System.getProperty("user.home")
           : textField.getText();
   JFileChooser fileChooser = new JFileChooser(startDirectory);
   fileChooser.setDialogTitle("Select Emacs " + name + " directory");
   fileChooser.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY);
   if (fileChooser.showOpenDialog(null) == JFileChooser.APPROVE_OPTION) {
     String dir = fileChooser.getSelectedFile().getAbsolutePath();
     textField.setText(dir);
     if (GlobalEnvironment.testProperty(type, dir)) {
       infoLabel.setText("Emacs " + name + " directory successfully set");
       label.setForeground(Color.black);
       return true;
     } else {
       onWrongProperty(label, type);
       return false;
     }
   } else {
     if (GlobalEnvironment.isEmacsPropertyOk(type)) return true;
     onWrongProperty(label, type);
     return false;
   }
 }
Example #16
0
 /**
  * A change in the text fields.
  *
  * @param e the document event.
  */
 private void documentChanged(DocumentEvent e) {
   if (e.getDocument().equals(fileCountField.getDocument())) {
     // set file count only if its un integer
     try {
       int newFileCount = Integer.valueOf(fileCountField.getText());
       fileCountField.setForeground(Color.black);
       LoggingUtilsActivator.getPacketLoggingService()
           .getConfiguration()
           .setLogfileCount(newFileCount);
     } catch (Throwable t) {
       fileCountField.setForeground(Color.red);
     }
   } else if (e.getDocument().equals(fileSizeField.getDocument())) {
     // set file size only if its un integer
     try {
       int newFileSize = Integer.valueOf(fileSizeField.getText());
       fileSizeField.setForeground(Color.black);
       LoggingUtilsActivator.getPacketLoggingService()
           .getConfiguration()
           .setLimit(newFileSize * 1000);
     } catch (Throwable t) {
       fileSizeField.setForeground(Color.red);
     }
   }
 }
Example #17
0
  public void save() {
    for (String key : fields.keySet()) {
      JComponent comp = fields.get(key);

      if (comp instanceof JTextField) {
        JTextField c = (JTextField) comp;

        if (c.getText().trim().equals("")) {
          sketch.configFile.unset(key);
        } else {
          sketch.configFile.set(key, c.getText());
        }
      } else if (comp instanceof JTextArea) {
        JTextArea c = (JTextArea) comp;

        if (c.getText().trim().equals("")) {
          sketch.configFile.unset(key);
        } else {
          sketch.configFile.set(key, c.getText());
        }
      }
    }

    sketch.saveConfig();
  }
  private boolean validateForm() {
    int error = 0;
    if (txtNome.getText().isEmpty()) {
      txtNome.setBorder(borderError);
      error++;
    } else txtNome.setBorder(borderDefault);

    if (txtCpf.getText().isEmpty()) {
      txtCpf.setBorder(borderError);
      error++;
    } else txtCpf.setBorder(borderDefault);

    if (txtEndereco.getText().isEmpty()) {
      txtEndereco.setBorder(borderError);
      error++;
    } else txtEndereco.setBorder(borderDefault);

    if (txtTelefone.getText().isEmpty()) {
      txtTelefone.setBorder(borderError);
      error++;
    } else txtTelefone.setBorder(borderDefault);

    if (txtEmail.getText().isEmpty()) {
      txtEmail.setBorder(borderError);
      error++;
    } else txtEmail.setBorder(borderDefault);

    if (error > 0) return false;
    return true;
  }
Example #19
0
  private void onBatch() {
    final boolean b = useBatchInputCheckbox.isSelected();

    orientationComboBox.setEnabled(b);
    lengthField.setEnabled(b);
    dpiXField.setEnabled(b);
    dpiYField.setEnabled(b);
    startDepthField.setEnabled(b);
    depthIncField.setEnabled(b);
    applyToAllButton.setEnabled(b);
    applyToSelectedButton.setEnabled(b);

    if (!b) {
      orientationLabel.setEnabled(b);
      lengthLabel.setEnabled(b);
      dpiXLabel.setEnabled(b);
      dpiYLabel.setEnabled(b);
      startDepthLabel.setEnabled(b);
      depthIncLabel.setEnabled(b);
    } else {
      orientationLabel.setEnabled(orientationComboBox.getSelectedIndex() != 2); // [Blank]
      lengthLabel.setEnabled(!lengthField.getText().equals(""));
      dpiXLabel.setEnabled(!dpiXField.getText().equals(""));
      dpiYLabel.setEnabled(!dpiYField.getText().equals(""));
      startDepthLabel.setEnabled(!startDepthField.getText().equals(""));
      depthIncLabel.setEnabled(!depthIncField.getText().equals(""));
    }
  }
Example #20
0
 public void setTextFieldText_Temp() {
   if (txt.getText().length() < 15 && (txt.getText().indexOf(".") == -1 || !s.equals("."))) {
     txt.setText(txt.getText() + s);
   } else {
     txt.setText((txt.getText() + s).substring(0, 15));
   }
 }
Example #21
0
 public void focusLost(FocusEvent event) {
   if ((curparam != null) && (event.getSource() == defval)) {
     guipanel.setDefaultValue(curparam, defval.getText());
     ((ComponentPanelInterface) comppanels.get(params.get(curparam)))
         .notifyDefaultValue(defval.getText());
   }
 }
Example #22
0
  private void realizarVenta() {
    boolean cantidadCorrecta = false;
    String str = "",
        strError =
            "Debes introducir una cantidad válida. Recuerda : \n 1) Sólo debes introducir números enteros; positivos \n 2) Debes dejar a lo más cero artículos en 'stock'";
    String strExistencia = tfExistencia.getText(), clave = "";
    int cantidad = 0;
    int existencia = Integer.parseInt(strExistencia);

    while (cantidadCorrecta == false) {
      str = JOptionPane.showInputDialog(null, "Cantidad a Vender = ");
      try {
        cantidad = Integer.parseInt(str);
        if ((cantidad < 0) || (cantidad > existencia))
          JOptionPane.showMessageDialog(null, strError);
        else {
          cantidadCorrecta = true;
          clave = tfClave.getText();
          resultado = lista.venderArticulos(cantidad, existencia);
          habilitarCampos(true);
          habilitarBotones(true);
          print(resultado);
        }
      } catch (NumberFormatException nfe) {
        System.out.println("Error: " + nfe);
        JOptionPane.showMessageDialog(null, strError);
      }
    }
  }
  /**
   * Validates that inputted info is correct, resets password info in database resets textfields to
   * empty string ""
   *
   * @throws SQLException throws exception if connection could not be made
   */
  public void Validator() throws SQLException {
    update.setText("");
    setUser(UsersConnection.getInfo(username.getText(), emailf.getText(), 5));
    boolean validInfo = true;
    String emailinfo = new String(emailf.getText());
    if (emailinfo.equals("")) {
      emailWrong.setText("<html>*You must enter email to<br>update your password<html/>");
      validInfo = false;
    } else if (!emailinfo.equals(u.getEmail())) {
      System.out.println("here!");
      emailWrong.setText("*Wrong email");
      validInfo = false;
    } else emailWrong.setText("");

    String passinfo1 = new String(password1.getPassword());
    if (!passinfo1.equals("") && passinfo1.length() < 4) {
      pass1Wrong.setText("Password must at least 4 charactor");
      validInfo = false;
    } else pass1Wrong.setText("");
    String passinfo2 = new String(password2.getPassword());

    if (passinfo2.equals(passinfo1)) pass2Wrong.setText("");
    else {
      pass2Wrong.setText("*Password does not match");
      validInfo = false;
    }

    if (validInfo) {
      if (!passinfo1.equals("")) u.setPassword(passinfo1);
      init();
      update.setText("Your information is up-dated");
      emailWrong.setText("");
    }
  }
  @Override
  public void actionPerformed(ActionEvent arg0) {
    // Pre-creation sanity
    if (gridPanel != null) {
      // Variable declaration
      String name, phone;
      // Make sure the fields have values
      if ((name = nameField.getText()) == "") {
        // Tell the user if not
        JOptionPane.showMessageDialog(null, "Please enter the client's name");
        return;
      }

      if ((phone = phoneField.getText()) == "") {
        JOptionPane.showMessageDialog(null, "Please enter the client's phone number");
        return;
      }

      if (hiddenRadio.isSelected()) {
        JOptionPane.showMessageDialog(null, "Please select the client's smoking preference");
        return;
      }

      // Calculate the party size
      int partySize = partyBox.getSelectedIndex() + 8;

      // Place the reservation
      bookRoom(name, phone, smokingRadio.isSelected(), partySize);
    } else {
      System.out.println("Grid panel is null");
    }
  }
  public void apply(CodeStyleSettings settings) {
    stopTableEditing();

    settings.LAYOUT_STATIC_IMPORTS_SEPARATELY = myImportLayoutPanel.areStaticImportsEnabled();
    settings.USE_FQ_CLASS_NAMES = myCbUseFQClassNames.isSelected();
    settings.USE_SINGLE_CLASS_IMPORTS = myCbUseSingleClassImports.isSelected();
    settings.INSERT_INNER_CLASS_IMPORTS = myCbInsertInnerClassImports.isSelected();
    try {
      settings.CLASS_COUNT_TO_USE_IMPORT_ON_DEMAND = Integer.parseInt(myClassCountField.getText());
    } catch (NumberFormatException e) {
      // just a bad number
    }
    try {
      settings.NAMES_COUNT_TO_USE_IMPORT_ON_DEMAND = Integer.parseInt(myNamesCountField.getText());
    } catch (NumberFormatException e) {
      // just a bad number
    }

    final PackageEntryTable list = myImportLayoutPanel.getImportLayoutList();
    list.removeEmptyPackages();
    settings.IMPORT_LAYOUT_TABLE.copyFrom(list);

    myPackageList.removeEmptyPackages();
    settings.PACKAGES_TO_USE_IMPORT_ON_DEMAND.copyFrom(myPackageList);

    myFqnInJavadocOption.apply(settings);
  }
Example #26
0
 public void jButton12_actionPerformed(ActionEvent e) {
   List<TerminalInfoStruct> TerminalInfo = new LinkedList<TerminalInfoStruct>();
   List<DataContentStruct> DataContentInfo = new LinkedList<DataContentStruct>();
   for (int i = 0; i < 50; i++) {
     TerminalInfo.clear();
     DataContentInfo.clear();
     TerminalInfoStruct tis = new TerminalInfoStruct();
     int l = 91010001 + i;
     String s = Integer.toString(l);
     tis.TerminalAddress =
         ("" + s.substring(0, 4) + s.substring(6, 8) + s.substring(4, 6)).toCharArray();
     tis.TerminalCommType = 40;
     tis.TerminalProtocol = 80;
     TerminalInfo.add(tis);
     DataContentStruct dcs = new DataContentStruct();
     dcs.DataContentLength = txt_content.getText().length();
     dcs.DataContent = txt_content.getText().toCharArray();
     DataContentInfo.add(dcs);
     rtc.SendBatchToFep(
         Integer.parseInt(txt_AppID.getText()),
         TerminalInfo.size(),
         TerminalInfo,
         DataContentInfo,
         txt_gnm.getText().toCharArray(),
         0,
         0,
         0,
         0);
     try {
       Thread.sleep(1000);
     } catch (InterruptedException ex) {
     }
   }
 }
Example #27
0
 /**
  * Based on the mode that is set by constructors and depending on the type of the mode value a
  * different value is returned.
  *
  * <p>The type of mode values are <code>int</code>, <code>double</code>, <code>String</code> and
  * <code>Pass</code>
  *
  * <p>Returns <code>null</code> if mode type does not match.
  */
 public Object getValue() {
   if (mode == INT) return (int) Integer.valueOf(inputfield.getText());
   else if (mode == DOUBLE) return (double) Double.valueOf(inputfield.getText());
   else if (mode == STRING) return (String) inputfield.getText();
   else if (mode == PASS) return (char[]) passfield.getPassword();
   else return null;
 }
Example #28
0
 public void handleNumber(String key) {
   if (isFirstDigit) display.setText(key);
   else if ((key.equals(".")) && (display.getText().indexOf(".") < 0))
     display.setText(display.getText() + ".");
   else if (!key.equals(".")) display.setText(display.getText() + key);
   isFirstDigit = false;
 }
 public Properties getProps() {
   props.setProperty("Database", database.getText());
   props.setProperty("Host_Name", host.getText());
   props.setProperty("Port", port.getText());
   props.setProperty("User_Name", user.getText());
   return props;
 }
Example #30
-1
  private void saveItem() {

    File f = new File("config.txt");

    if (f.exists() && !f.isDirectory()) {

      try (PrintWriter out =
          new PrintWriter(new BufferedWriter(new FileWriter("config.txt", true)))) {
        if (!searchName.getText().equals("") && !item.getText().equals("")) {

          out.println(
              searchName.getText()
                  + ","
                  + "http://www.reddit.com/r/hardwareswap/search?q="
                  + item.getText()
                  + "&sort=new&restrict_sr=on");
          addItem();

        } else {

          results.setText("Please provide all info for Search Name and Item");
        }

      } catch (IOException e1) {
        results.append("Error saving to file.");
      }

    } else {
      Main.checkFiles();
    }
  }