java - I need a way to manipulate the last character in a JTextArea (by deleting it) -
i have jtextarea can fill text using jbuttons. want jbutton can use backspace without using robot class or backspace key, clicking button on screen mouse. how manipulate text using public void actionperformed(actionevent e) {
of jtextarea using button, using self-created backspace key? let me know if have questions or confused on i'm asking.
take @ document
.
every text component in swing has document
model controls state of text (and applicable, attributes , structure).
you can use jtextarea
's document
remove characters directly.
something like...
document doc = textarea.getdocument(); doc.remove(doc.getlength() - 2, 1);
Comments
Post a Comment