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

Popular posts from this blog

c# - DetailsView in ASP.Net - How to add another column on the side/add a control in each row? -

javascript - firefox memory leak -

Trying to import CSV file to a SQL Server database using asp.net and c# - can't find what I'm missing -