public void Load(String Varname, int value, JTextField parent, String targetCard) { this.FieldParent = parent; this.VarName.setText(Varname); this.TargetCard = targetCard; this.NumberField.setText(String.valueOf(value)); NumberField.getCaret().setVisible(true); }
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