public void actionPerformed(ActionEvent evt) { JEditTextArea textArea = getTextArea(evt); textArea.getInputHandler().setRepeatEnabled(true); String actionCommand = evt.getActionCommand(); if(actionCommand != null) { textArea.getInputHandler().setRepeatCount( Integer.parseInt(actionCommand)); } }
public void actionPerformed(ActionEvent evt) { JEditTextArea textArea = getTextArea(evt); String str = evt.getActionCommand(); int repeatCount = textArea.getInputHandler().getRepeatCount(); if(textArea.isEditable()) { StringBuffer buf = new StringBuffer(); for(int i = 0; i < repeatCount; i++) buf.append(str); textArea.overwriteSetSelectedText(buf.toString()); } else { textArea.getToolkit().beep(); } }