Results 1 to 6 of 6
  1. #1
    beasten is offline Member
    Join Date
    Nov 2008
    Posts
    3
    Rep Power
    0

    Default Create a shortcut

    I've got a problem with a shortcut. In my program there's a list of books, and when I select a book there's a " Remove this book"-button. I need a shortcut to this removal-button. At first I solved it with Mnemonic, but thats no good. I dont want to press "alt+delete" to remove the selected book, I only want to press the "delete" button on the keyboard. Anyone knows how to create these type of shortcuts?

  2. #2
    Nicholas Jordan's Avatar
    Nicholas Jordan is offline Senior Member
    Join Date
    Jun 2008
    Location
    Southwest
    Posts
    1,018
    Rep Power
    7

    Default

    Keyboard Shortcutsclass googlem extends amazingDaze
    Introduction to Programming Using Java.
    Cybercartography: A new theoretical construct proposed by D.R. Fraser Taylor

  3. #3
    beasten is offline Member
    Join Date
    Nov 2008
    Posts
    3
    Rep Power
    0

    Default

    Been readin that one before, tho I cant get it to work, nor the example. But I'll give it another try. Ta

  4. #4
    Nicholas Jordan's Avatar
    Nicholas Jordan is offline Senior Member
    Join Date
    Jun 2008
    Location
    Southwest
    Posts
    1,018
    Rep Power
    7

    Default

    What are the error messages?
    Introduction to Programming Using Java.
    Cybercartography: A new theoretical construct proposed by D.R. Fraser Taylor

  5. #5
    beasten is offline Member
    Join Date
    Nov 2008
    Posts
    3
    Rep Power
    0

    Default

    I dont even get an error message. Been workin with accelerators now, but cant find out how to get it to work with no "ctrl+delete", just "delete". I think its something with the focus. Mabye I shouldnt try to bind my programmed button with the delete cmd, just get the selection in my list to get focus and then.. do something that deletes the item!?

  6. #6
    Nicholas Jordan's Avatar
    Nicholas Jordan is offline Senior Member
    Join Date
    Jun 2008
    Location
    Southwest
    Posts
    1,018
    Rep Power
    7

    Default

    It's been awhile, but I remeber focus traversal for buttons. I had a giant switch nearly wrote once trying to write a keyboard handler - I remember it can be done, runs something along the lines of if event.typeof == keyEvent ( or whatever the sytax is ) then you can track along a switch working as many as you want.

    I forgot where it is,....
    Introduction to Programming Using Java.
    Cybercartography: A new theoretical construct proposed by D.R. Fraser Taylor

Similar Threads

  1. System.out.println Shortcut
    By AdamCCFC in forum New To Java
    Replies: 23
    Last Post: 11-13-2011, 03:45 PM
  2. eclipse keyboard shortcut
    By taurean in forum Eclipse
    Replies: 1
    Last Post: 10-01-2008, 12:09 PM
  3. More than one KeyStroke (Shortcut) for a JMenuItem
    By hannehomuth in forum Advanced Java
    Replies: 0
    Last Post: 07-25-2008, 03:35 PM
  4. Undo shortcut malfunctioning.
    By Eranga in forum NetBeans
    Replies: 0
    Last Post: 03-31-2008, 05:12 AM
  5. How to add a shortcut key from JTextArea
    By sukatoa in forum Advanced Java
    Replies: 2
    Last Post: 01-28-2008, 08:39 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •