Is there a way to trigger button's action listeners from key events?

I rarely do GUI programming, especially not in Java. But now I am working on a GUI app and would like to get some help.
Say I have a simple GUI consists of a JFrame, and a bunch of buttons on its JToolBar. The buttons on the JToolBar are for navigation of a set of documents, first, prev, next, last etc. All buttons are assigned action command strings, and their all trigger the same instance of action listener. inside of the action listener, it does the correct navigation based on the action command from the event.
but some users want to be able to use the keyboard to do the navigation, because they think clicking the buttons are too slow.
So is there a graceful way to receive the different key press events and trigger corresponding navigation actions (hopefully it reuses the code that is already there, e.g. the action listener)? thanks.
-- Jim

but some users want to be able to use the keyboard to do the navigation, because they think clicking the buttons are too slow. That is always the case in any GUI. Any application should be designed to use either the mouse or the keyboard.
All buttons are assigned action command strings,That is not the way the GUI should be designed.
Instead you should be creating Actions. Then you can add the Action to a button and you can associate the Action with a KeyStroke which is called "Key Binding". This is the way all Swing components work. You can read the [url http://download.oracle.com/javase/tutorial/uiswing/TOC.html]Swing tutorial for more information and examples. Start with the section on:
a) How to Use Actions
b) How to Use Key Bindings

Similar Messages

  • Is there any way to trigger BSP Page from ITS..

    Hi,
      is there any way to trigger BSP Page from ITS?
      say for example i have a its service, when i click my its service i want to call BSP Page instead of calling module pool screen.
    thanks,
    Abhay.

    do you want to have a link the ITS page which calls a BSP page or do want a simple call the ITS url should redirect you to BSP page?
    for your explanation i understand that calling a ITS service should automatically redirect to BSP page -  in such a case you can just use url redirection by using meta tag or reidrect using javascript.
    <META HTTP-EQUIV="Refresh"
          CONTENT="5; URL=<BSP page>.htm">
    But i dont understand the reason why you would want to do this.
    Regards
    Raja

  • My mac book is not working so i can no longer use my mac to back up my note in my phone and unfortunately i dont have outlook on my pc is there a way to get all my old notes from my 3gs to my 4s iphone?

    my mac book is not working so i can no longer use my mac to back up my note in my phone and unfortunately i dont have outlook on my pc is there a way to get all my old notes from my 3gs to my 4s iphone?

    Reset, hold both home and power buttons until the iPhone begins to start, try this a few times if necessary. If still problem, you may have to just Restore your iPhone to get it working. In the future sync your iPhone with iTunes routinely and when it contains important data, iCloud when set correctly will do this for you continuously.

  • I am not very tech savvy, installed Firefox and it w0n't communicate with my email (incredimail). also is there a way to transfer my favorites/bookmarks over from IE to firefox? Those two things would be a great start!

    I am not very tech savvy, installed Firefox and it won't communicate with my Incredimail. If I click on a link in my email it does nothing. ie: if i click on the pay now button on ebay or paypal it goes nowhere. also is there a way to transfer all my favorites/bookmarks from IE to firefox. I've heard Firefox is so much better than IE but I am getting frustrated (probably out of my own ignorance of the program) and ready to go back to IE. Please help! Thanks. Jeanne

    I cannot help with Incredimail, but I do know how to transfer bookmarks.
    One can use File > Import from the menu or export favourites from IE as .html and then import the file into Firefox from the "Show all bookmarks" window. To get the menu to show up, press Alt. Firefox should have offerecd to import several items from IE when you first set it up. Did it not do that?

  • Is there a way to know how many minutes left from ...

    Is there a way to know how many minutes left from your subscription from the Skype phone app??
    Thanks!

    Hi, Konfuzed,
    Thanks for your inquiry. The Skype Mobile apps look a bit different.  In order for the Skype Community to help you, some more information would be helpful:
    - Hardware you use (phone/tablet brand and model)
    - Its operating system (version and updates installed)
    - Skype version used
    Thanks in advance.
    - Skype Community Moderation Team
    Was your question answered? Please click on the Accept as a Solution link so everyone can quickly find what works! Like a post or want to say, "Thank You" - ?? Click on the Kudos button!
    Trustworthy information: Brian Krebs: 3 Basic Rules for Online Safety and Consumer Reports: Guide to Internet Security Online Safety Tip: Change your passwords often!

  • Is there a way once I have brought a movie from iTunes on my iPad to download it onto my laptop.

    Is there a way once I have brought a movie from iTunes on my iPad to download it onto my laptop

    You should in future download to iTune (computer) and sync to iPad.

  • Is there a way to check what I had purchased from the itune store to match the charges on my credit card, because there is a charge that I do not recognize

    Is there a way to check what I had purchased from the itune store to match the charges on my credit card, because there is a charge that I do not recognize

    http://support.apple.com/kb/HT2727
    Regards.

  • I have a first generation iPad and got my husband the iPad 2 for xmas.  is there a way to transfer his tiny tower game from my iPad to his without using the same iTunes account?

    I have a first generation iPad and got my husband the iPad 2 for xmas.  is there a way to transfer his tiny tower game from my iPad to his without using the same iTunes account?

    Apps are only tied to one account... You can set up two iTunes accounts on your computer, however, and let his iPad sync to his account. If he has never backed up his apps to a computer, however, he will have to redownload all the apps. Afterwards, he can backup to iCloud instead of your computer.
    http://support.apple.com/kb/ht1495

  • I have an iphone and an ipad (which are connected by the same apple id) i broke the phone and sold it but i didnt get to factory reset it because it was broken, is there any way for me to wipe my iphone from my ipad?

    i have an iphone and an ipad (which are connected by the same apple id) i broke the phone and sold it but i didnt get to factory reset it because it was broken, is there any way for me to wipe my iphone from my ipad?

    Try this:
    Open the "Find my iPhone" app on your iPad, fill in your AppleID and password at the start up screen, and you should see a list of all your devices and their current location, if connected to a Wi-Fi or mobile data network. Devices not connected will be shown as "offline". But you can still trap on the icon and hit "erase iPhone" in the right hand window.
    If your iPhone is not listed, you did not activate this feature during the setup of the phone and it can't be erased remotely.
    If the phone is listed, even as offline, tap on "erase" to send the erase command. The next time your device will be connected to any kind of network, the content will be erased.

  • Is there a way to exclude temporary people picker fields from a query when receiving the "List View Lookup Threshold" error.

    Hi All,
    My users require the ability to select a sharepoint group from a drop down list and then be able to select a user from a people picker based on the drop down selection.    The best solution I was able to up with, was create a people picker
    for each drop down selection and set the Sharepoint group field to the selected group.  All people picker filed are hidden except the one that matches the drop down selection.  When creating an entry from the sharepoint list this method
    works perfectly.
    However, when I add the list onto a site page using an "Listview webpart", then add an infopath web part and then finally connect the two parts, I get a "List View Lookup Threshold" error when selecting an entry from the list.  I
    understand from the error and reading that this error is related to the number of People pickers in the list.   Is there a way to exclude temporary people picker fields from a site page query, as they are only temporary fields to allow the users
    to select a person and then assign the name to another field.
    Dwayne

    Hi Dwayne,
    In SharePoint 2013, we could manually create a list for all users. Here are the reference:
    Go to Site Settings >  People and Groups > SiteMembers
    Modify url
    http://sitename/_layouts/15/people.aspx?MembershipGroupId=8 to
    http://sp/sites/tutu/_layouts/15/people.aspx?MembershipGroupId=0 , now you will see All people in this site.
    Change the view to List view, and copy the listview id in the url
    http://sitename/_layouts/15/people.aspx?MembershipGroupId=0&View={viewID}
    Go to Settings > List settings, copy the list id in the url
    http://sitename/_layouts/15/listedit.aspx?List=listeid&Source=....
    Now type the address in IE:
    http://sitename/_vti_bin/owssvr.dll?CS=109&Using=_layouts/query.iqy&List=[LISTID]&View=[VIEWID]&CacheControl , such as
    http://sp/sites/tutu/_vti_bin/owssvr.dll?CS=109&Using=_layouts/query.iqy&List=f3958d27-9c2f-4f8d-b221-89466e816667&View=696BFDC5-0C6E-4E27-818F-0E6292A18407&CacheControl=1
    Save the owssvr.jqy from SharePoint site
    Now you could see the file in your desktop with all users, save it as allusers in Excel.
    Then import it to your SharePoint site, add an app > find an app > import spreadsheet
    Regards,
    Rebecca Tu
    TechNet Community Support

  • Is there a way to create a new Calendar that replicates all events

    Is there a way to create a new Calendar that replicates all events from a subscribed calendar ? Mobile Me is great but my most important Calendar is technically in the "Subscriptions" category so it doesn't get pushed to me iPhone. I want to create a new Calendar and have it just automatically copy all the events from the subscribed calendar and keep up to date with that one.

    lincolnroadjeff,
    I subscribed to a Holiday calendar that I also wanted to be published, and the only workaround that I found was to export the calendar, delete the subscription, and then import the calendar.
    This obviously will only work with a subscription that is not often updated/subject to change.
    ;~)

  • Is there a way to create a "Horizontal Links List" from a query?

    Hi,
    Is there a way to create a "Horizontal Links List" from a query?
    I want to display file names that I have uploaded as links to a display page.
    I don't know how to create my own template yet as I've read... I saw Jes had posted this idea...
    Thanks, Bill

    Yes, that is great Chris!
    Thanks for the site....
    Once I dynamically create the HTML for the list how do I feed it into the page?
    as an item? Can I access an HTML region body dynamically?
    Thanks, Bill

  • Is there a way to trace back an indesign document from which a certain jpeg was exported?

    I have a jpeg image that was exported from indesign a long time ago. I no longer know where the indesign file is located or it's name, but I need to edit the text of the jpeg and the only way to do that is by editing the original indesign document and reexporting it. Is there a way to trace back an indesign document from which a certain jpeg was exported?

    boshalosh wrote:
    I have a jpeg image that was exported from indesign a long time ago. I no longer know where the indesign file is located or it's name, but I need to edit the text of the jpeg and the only way to do that is by editing the original indesign document and reexporting it. Is there a way to trace back an indesign document from which a certain jpeg was exported?
    Depending on how the text interacts visually with the image, it might be possible to use the fill property of the content-aware deletion feature of recent Photoshop versions to remove the text with little or no evidence of the deletion, then apply text over the graphic however you like.
    HTH
    Regards,
    Peter
    Peter Gold
    KnowHow ProServices

  • Is there a way of transferring data (music, movies etc) from an external hard drive directly to an iPad Mini?

    Hi Guys,
    Is there a way of transferring data (music, movies etc) from an external harddrive directly to an iPad Mini?
    The reason I ask, is I'm going travelling and don't want to take my macbook with me - but I have a lot of music, movies etc that I want to take.
    Is this possible?
    Thanks, Fintan

    Thanks all.
    I've just come across Hyper Drive Cloud FTP - which allows you to connect any external harddrive or USB stick via WiFi.
    Looks like a pretty good option.
    I've also read that you can use GoodReader app to download files from harddrive to iPad.
    Good review on Wired - http://www.wired.com/reviews/2012/07/cloudftp/
    Product site - http://www.hypershop.com/iUSBport-by-HyperDrive-formerly-CloudFTP-s/218.htm
    Let me know what you think?!

  • Is there a way to view my firefox bookmarks online from any pc through a browser?

    Is there a way to view my firefox bookmarks online from any pc through a browser?

    Hi!
    Short answer is no. And unfortunately there's no really longer answer. Firefox Sync's vision and product design is to allow you to have all your information in all your browsers.
    The really long answer is that they are some other projects on the works that will cover the case that you refer to: you are in a computer that is not yours and you want to access once with your home set-up. Unfortunately at the moment is just an idea.

Maybe you are looking for

  • How do I change the border color of a numeric indicator?

    I just started using LabVIEW again after a several year hiatus (I used to use it a LOT).  With the paintbrush tool, should I not be able to right click a numeric indicator's border and select T for transparent to make the border disappear?  Fo the li

  • Audit columns not updated when update statement is invoked

    I am trying to perform DML operation using "Process Row" process. I have provided the default values for audit columns in the default section of the page item attributes. When I insert, the record is inserted with proper default values. The problem a

  • Entered a promise to pay, but had to mail a check.

    I entered into a promise to pay on Saturday (6/20) and I had all hopes paying it yesterday (6/25), but when I went to do it, I was declined, which I thought was odd, since I had just cashed my check earlier that day. Thought about trying again later

  • Friday Fun Question! Inter-Org Free Busy after 2010 Migration

    We are one segment of a multi-part company across the world. We have about 5 segments that operate independently (Domain, Exchange environment, the whole 9).  I did a 2007 -> 2010 Migration and now free/busy does not work inter-org. My users can see

  • Lost Lens Profiles in LR5 on MBP running Yosemite

    LR5 on my Mac Book Pro (after upgrading OS X to Yosemite) does not list all the lens profiles for Nikon or third party lenses and offers only 5-6 choices, non of which match my lenses.