Esempio n. 1
0
 protected void ok() {
   try {
     int runs = Integer.parseInt(runsField.getText());
     int steps = Integer.parseInt(stepsField.getText());
     ((TrajPanel) context).runRandomUpdateTraj(runs, steps);
   } catch (NumberFormatException ex) {
     ((TrajPanel) context).runRandomUpdateTraj(-1, -1);
   }
 }
 private void BackspaceButtonActionPerformed(
     java.awt.event.ActionEvent evt) { // GEN-FIRST:event_BackspaceButtonActionPerformed
   if (NumberField.getCaretPosition()
       != 0) { // only do something if the caret is not the at the beginning
     int tmpcaretpos = NumberField.getCaretPosition();
     NumberField.setText(
         NumberField.getText().substring(0, NumberField.getCaretPosition() - 1)
             + NumberField.getText()
                 .substring(NumberField.getCaretPosition(), NumberField.getText().length()));
     NumberField.setCaretPosition(tmpcaretpos - 1);
   }
 } // GEN-LAST:event_BackspaceButtonActionPerformed
 private void DelButtonActionPerformed(
     java.awt.event.ActionEvent evt) { // GEN-FIRST:event_DelButtonActionPerformed
   if (NumberField.getCaretPosition()
       != NumberField.getText().length()) { // only do something if the caret is not the at the end
     int tmpcaretpos = NumberField.getCaretPosition();
     NumberField.setText(
         NumberField.getText().substring(0, NumberField.getCaretPosition())
             + NumberField.getText()
                 .substring(NumberField.getCaretPosition() + 1, NumberField.getText().length()));
     NumberField.setCaretPosition(tmpcaretpos);
   }
 } // GEN-LAST:event_DelButtonActionPerformed
 void AppendCharacter(String character) {
   int tmpcaretpos =
       NumberField
           .getCaretPosition(); // save positon of the caret so we can use it again after replacing
                                // the string
   NumberField.setText(
       NumberField.getText().substring(0, NumberField.getCaretPosition())
           + character
           + NumberField.getText()
               .substring(NumberField.getCaretPosition(), NumberField.getText().length()));
   NumberField.setCaretPosition(tmpcaretpos + 1); // use the save caret position again
   NumberField.getCaret().setVisible(true);
 }
  private void SettingsOKButtonActionPerformed(
      java.awt.event.ActionEvent evt) { // GEN-FIRST:event_SettingsOKButtonActionPerformed
    this.FieldParent.setText(NumberField.getText());

    CardLayout cl = (CardLayout) (Parent.GetCardManager().getLayout());
    cl.show(Parent.GetCardManager(), TargetCard);
  } // GEN-LAST:event_SettingsOKButtonActionPerformed
 private void NumberMinus10ActionPerformed(
     java.awt.event.ActionEvent evt) { // GEN-FIRST:event_NumberMinus10ActionPerformed
   int temp = Integer.parseInt(NumberField.getText()) - 10;
   if (temp < 0) {
     temp = 0;
   }
   NumberField.setText(String.valueOf(temp));
 } // GEN-LAST:event_NumberMinus10ActionPerformed
 private void NumberPlusTenActionPerformed(
     java.awt.event.ActionEvent evt) { // GEN-FIRST:event_NumberPlusTenActionPerformed
   int temp = Integer.parseInt(NumberField.getText()) + 10;
   if (temp < 0) {
     temp = 0;
   }
   NumberField.setText(String.valueOf(temp)); // TODO add your handling code here:
 } // GEN-LAST:event_NumberPlusTenActionPerformed
 private void EndButtonActionPerformed(
     java.awt.event.ActionEvent evt) { // GEN-FIRST:event_EndButtonActionPerformed
   NumberField.setCaretPosition(NumberField.getText().length());
   NumberField.getCaret().setVisible(true);
 } // GEN-LAST:event_EndButtonActionPerformed