Win a copy of Practical SVG this week in the HTML/CSS/JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Backspace functionality of keyboard to be implemented in a jbutton

 
ricky shaw
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi All,
I have a JButton which is supposed to perform the backspace functionality just like the keyboard backspace . Right now i have a JButton which removes one character per click. Could someone please help me with this. This is my code for backspace now
 
Darryl Burke
Bartender
Posts: 5155
11
Java Netbeans IDE Opera
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Obtain a reference to the Action associated with the backspace key from the textfield's InputMap and ActionMap and invoke the Action's actionPerformed from the button's listener.

If you don't have any experience in what I'm talking about, you'll want to go through this tutorial.

edit The finer details will depend on whether you want to use the button as an on-screen backspace for one particular text component, or as a part of a more general on-screen keyboard. Either way, you will want to make the button non-focusable.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!