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
 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
 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 RightButtonActionPerformed(
     java.awt.event.ActionEvent evt) { // GEN-FIRST:event_RightButtonActionPerformed
   NumberField.setCaretPosition(NumberField.getCaretPosition() + 1);
   NumberField.getCaret().setVisible(true);
 } // GEN-LAST:event_RightButtonActionPerformed
 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