Setting mnemonic keys

I am trying to create a mnemonic key event for F3. My problem is it works only when ALT F3 is pressed and not just F3. Any idea why?
  findTxtArea.getInputMap().put(KeyStroke.getKeyStroke(KeyEvent.VK_F3,0),"f3");
       findTxtArea.getActionMap().put("f3",
                 new AbstractAction("f3"){
                 public void actionPerformed(ActionEvent evt){
                 doFindNext();
                 });

Bumping while still in the 10 most recent posts? You are on a tight deadline!
Ok, the input map has a condition associated with it for when it applies. By default it's used when the component is focused. You might just be after using the "when in focused window" condition. You can then grab the focus to your text area if you wish.
Try this:
     public static void main(String[] args) {
          KeyStroke ks = KeyStroke.getKeyStroke(KeyEvent.VK_F3, 0);
          JTextArea ta = new JTextArea();
          ta.getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW).put(ks, "f3");
          ta.getActionMap().put("f3", new AbstractAction() {
               public void actionPerformed(ActionEvent e) {
                    System.err.println(e);
                    ((JTextArea)e.getSource()).requestFocus();
          JFrame frame = new JFrame();
          frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
          frame.getContentPane().setLayout(new GridLayout(2, 1));
          frame.getContentPane().add(ta);
          frame.getContentPane().add(new JButton("Foo"));
          frame.pack();
          frame.show();
     }Hope this helps.

Similar Messages

  • Set Mnemonic with numpad not working?

    Hello,
    I think I must be I must be being thick.
    I have a JTabbedPane and I'm want to use shortcut keys to access each pane.
    I am Setting the Mnemonic for each pane with
    mainTabbedPane = new JTabbedPane();
    mainTabbedPane.setMnemonicAt(0, KeyEvent.VK_NUMPAD0);
    mainTabbedPane.setMnemonicAt(1, KeyEvent.VK_NUMPAD1);
    mainTabbedPane.setMnemonicAt(2, KeyEvent.VK_NUMPAD2);
    mainTabbedPane.setMnemonicAt(3, KeyEvent.VK_NUMPAD3);
    But it's not working. Alt and any other key seems to be working fine.
    Is there an issue with the Number pad and set Mnemonic?
    I am using JDK 1.5
    Cheers
    Mark

    Hi. I have just the same problem. Any solution ?

  • To set access key for push button in oracle forms 11g

    Dear Team,
    I have following setup:-
    We are using oracle database 11gR2
    Oracle Forms & reports : 11.1.2
    O.S : Windows 7 Professional
    We have migrated oracle forms version from 6i to 11g
    In oracle forms 6i in save button's property palette we set access key as 'S', so when we press alt+S cursor move to save button, same is not working in oracle forms 11g.
    What changes I have to made in new version so that after pressing alt+S cursor will move to save button.
    Any help is appreciated.
    Thanks in Advance.

    You will need to define your custom key map in the key mapping file you use. Typically fmrweb.res or fmrpcweb.res. Edit the file in a text editor and take a look to figure out where you need to make the change.This is wrong! The OP is talking about the Access Key (key mnemonic's) of a button. This has nothing to do with the mapping of keys in the frmweb.res, etc., files.
    @parapr, You don't mention the Java version installed and you don't mention if your OS is 32-bit or 64-bit. Likely, this issue could be related to an incompatible Java version. We use Access Keys in our 11g R2 application and they work just fine. Our Java version is 1.6.0_31. If you are using Java 1.7.0 - this version is not yet certified with Oracle Forms and I would recommend you downgrade to 1.6.0 (latest version).
    Craig...
    Edited by: CraigB on Dec 3, 2012 9:09 AM

  • Alt+mnemonic key is not working properly for Menu Items

    Assume there are two menus , File Menu with mnemonic Alt+F
    and Save Menu with mnemonic Alt+S. File Menu contains the
    menu items like PageSetup with Mnemonic S. Save menu has
    the menu item Properties with Mnemonic P.
    Pressing Alt+F opens the File Menu which has the menu item
    PageSetup.Pressing S activates the PageSetup menu item.
    Similarly Pressing Alt+S opens the Save Menu which has the
    menu item Properties. Pressing P activates the Properties
    menu item acion. But Pressing Alt+P also activates the
    Properties menu item action(it is not the desired behaviour)
    Pressing Alt+Mnemonic key has to open only the Menus.It
    should not consider the menu items.
    STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
    1.Press Alt+F
    2.File Menu is invoked
    3.Press S
    4. Invokes the menu item action
    5. Press Alt+S
    6. Save menu is invoked
    7. Press P
    8. Invokes the menu item action
    9. Press Alt+P
    10. Invokes the menu item action
    EXPECTED VERSUS ACTUAL BEHAVIOR :
    Pressing of Alt+Mnemonic key invokes the menu and also menu
    item actions. If the same mnemonic is present in the Menu
    it is giving the priority to Menu only.Pressing of Alt key
    alone does not hiding the pull down menu
    Expected Result;
    Pressing of Alt+Mnemonic key has to list out the pull
    down menu only.It should not consider the menu items with
    the same mnemonic. If Alt key alone is pressed the pull
    down menu has to hide.
    REPRODUCIBILITY :
    This bug can be reproduced always.
    ---------- BEGIN SOURCE ----------
    import java.awt.*;
    import java.awt.event.*;
    import javax.swing.*;
    public class JavaBug extends JFrame
    public JavaBug()
    // Create menu bar
    JMenuBar menuBar = new JMenuBar(); // Create menu bar
    setJMenuBar(menuBar); // Add menu bar to window
    // Create first option on menuBar
    JMenu m1 = new JMenu("File");
    m1.setMnemonic('F');
    JMenuItem m1o1 = new JMenuItem("PageSetup");
    m1o1.setMnemonic('S');
    m1o1.addActionListener(new ActionListener() {
    public void actionPerformed(ActionEvent e) {
    System.out.println("File/PageSetup was selected");
    m1.add(m1o1);
    // Create second option on menuBar
    JMenu m2 = new JMenu("Save");
    m2.setMnemonic('S');
    JMenuItem m2o1 = new JMenuItem("Properties");
    m2o1.setMnemonic('P');
    m2o1.addActionListener(new ActionListener() {
    public void actionPerformed(ActionEvent e) {
    System.out.println("Save/Properties was selected");
    m2.add(m2o1);
    menuBar.add(m1);
    menuBar.add(m2);
    this.setTitle("Mnemonic Bugs");
    addWindowListener(new WindowAdapter() {
    public void windowClosing(WindowEvent e) {
    System.exit(0);
    setSize(400,250);
    show();
    public static void main(String[] args)
    JavaBug bug = new JavaBug();
    Suggestions welcomed
    punniya

    I tried your code, but didn't get your "bug" using jdk 1.3 on windows 2000 (at my school).
    Kind regards,
    Levi

  • Photos will not allow me to set the key picture for the album or event

    Photos will not allow me to set the key picture for the album or event - it is set to grey !
    Anyone else had this and found why ?
    new PHOTO app replacing iPhoto bugs/ Problems OTHER PROBLEMS :
    - no longer has a five star rating system
    - my keywords for selecting albums are gone.
    - cannot copy location of one photo to another
    - cannot have an album with  keywords AND rating > a value
    - cannot set key photo of album/event
    - multi parameter search feature gone
    Anyone got any ideas how to get around this terrible downgrade of the software ?
    BTW I have just discovered that iPhoto and its' libraries are still there, so I can go back but be left behind and frozen in time on this version if I do.
    Photos now take up 700Gb whereas it was 350Gb  #@!$#@!@#!@#
    Thanks

    That are all good points - but Photos is a completely new application. and it is only version 1.
    Continue to use iPhoto, girraween; the next update to Photos will probably add a few more features.
    iPhoto 9.6.1 is working very well with MacOS X 10.10.3.
    The migration let iPhoto installed and also your iPhoto Library will still work with iPhoto.
    If you did not uninstall iPhoto, it will still be there in your Applications folder.  And if you had updated to the latest version iPhoto 9.6.1 before you upgraded to MacOS X 10.10.3,  you can simply drag iPhoto back to the Dock from your Applications folder and continue to use it. Double click iPhoto and confirm, that you want to open iPhoto and not Photos.   It is not compulsory to use Photos, while it it still the first release. When you launch iPhoto, you will see a warning, that the iPhoto Library has been migrated to Photos, but simply click the "Open iPhoto" button.The library will still work with iPhoto. ()see: If Photos won't open a library that you already migrated - Apple Support
    If your iPhoto version is not iPhoto 9.6.1, you need to update it.
    See this User Tip:
    Usually it will work to reinstall instead of updating:
    Get iPhoto 9.6.1 if you didn't update before OS... | Apple Support Communities
    The main idea is to move the iPhoto app to the Trash, so Spotlight does not see it as installed, reload the AppStore, and then to try to download again from the App Store - from your Purchases tab, not from the main page, since you can neither buy iPhoto nor update it, but you can reinstall, if your AppleID is associated with it.
    Meanwhile you may want to send a feature request to Apple using the feedback form. Apple - Photos - Feedback
    I hope, Apple will listen and add more features to Photos to make it usable for large Photo Libraries.

  • Setting primary key fields from sequence. Please advise

    What is the most logical place to automatically set primary key fields from
    sequence?
    jdoPrestore seems to be a little late - my instance will not have id till
    it's committed. I can not do it in constructor because it gets called every
    time Kodo needs to construct an instance. What other options do I have for
    automatic pk assignment except do it in my code (hate it)?
    I wish I could use store managed OIDs but I need access to OID underlying
    data
    Please also see my previous message "Application Identity Extention"

    I came up with following pattern:
    public class OrgUnit implements InstanceCallbacks {
    private long orgUnitId = -1;
    private transient long tempOrgUnitId = -1;
    public long getOrgUnitId() {
    if (orgUnitId < 0) {
    if (tempOrgUnitId < 0) {
    tempOrgUnitId = JDOFactory.getNextSequenceId(getClass());
    return tempOrgUnitId;
    } else {
    return orgUnitId;
    public void jdoPreStore() {
    if (!JDOHelper.isDeleted(this)) {
    if (orgUnitId < 0) {
    setOrgUnitId(getOrgUnitId());
    I use -1 as an indicator that ID has not been assigned yet. If you use Long
    instead of long it will be cleaner since we can test for null
    "Alex Roytman" <[email protected]> wrote in message
    news:9q27co$r35$[email protected]..
    What is the most logical place to automatically set primary key fieldsfrom
    sequence?
    jdoPrestore seems to be a little late - my instance will not have id till
    it's committed. I can not do it in constructor because it gets calledevery
    time Kodo needs to construct an instance. What other options do I have for
    automatic pk assignment except do it in my code (hate it)?
    I wish I could use store managed OIDs but I need access to OID underlying
    data
    Please also see my previous message "Application Identity Extention"

  • JCOP : can't set a new key set (put-key pb)

    Hi!
    I have this brand new cell phone out of the box , and I've been asked to install a javacard applet on it. I did it for other phones already, but I can't manage to install my app on this one.
    For new phones I have to install a new key set. That's where it goes wrong with this phone.
    And I don't want to try too hard, because I've been told that after too many tries, the card can be locked/damaged 0_0�
    Here's what's happening :
    cm> set-my-keys
    /set-var KEYS-1
    "1/1/DES-ECB/[mykey1] 1/2/DES-ECB/[mykey2] 1/3/DES-ECB/[mykey3] "
    set-key ${KEYS-1}
    put-keyset 1
    Add new key set didn't work, try modify ... (I've masked the key values)
    an after an "init" command, I get this message :
    Status: Security condition not satisfied
    jcshell: Error code: 6982 (Security condition not satisfied)
    jcshell: Wrong response APDU: 6982(I also tried "init-update 255", didn't work neither)
    Can somebody help me, and does anybody knows a good information source about these matters? (because I searched the net but there's few infos about JCOP out there)
    Thanks for your help!

    ah ok.
    I can't read any answer from init update since I get an error message each time.
    But here's another example of a pb I had on another phone ^_^ ... :
    I've been given a NFC phone because one couldn't install anything on it by using a "home made" application.
    I tried to install it via JCOP, but I just managed to install it manually (i.e.
    set keys (script)
    init
    ext-auth
    But the run configuration of the Eclipse+JCOP project failed to install it. I'm using key set number 1. In the config window of the Run I've been adviced to change the key set parameter of the init update command from 1 to 0 (in order to choose default, which normally should be the same) and then it works....
    But I was wondering wheras the key set that were used was actually number 1 when I saw your answer : here's the init update response :
    00 00 52 74 00 41 78 90 81 08 [u]FF 02 [/u]00 04 F6 4D   
    BA 43 42 A1 5E 26 A2 C4 98 4E 3E C6 90 00 Then I looked for a website which could tell me how to know where to look at in this apdu ti see which keyset is used. I found
    (http://www.informatik.uni-augsburg.de/lehrstuehle/swt/se/teaching/ss05/javasm05/downloads/Vorlesung6.pdf)
    I underlined bytes that seem to be concerned. Can you tell me that it is indeed key set 255 (FF) that's used instead of keyset 1? Or Am I wrong, and in that case, can you correct me? :)
    thanks

  • Can't set WEP key for broadcom-wl?

    I did a fresh install of Arch this morning at my office. I have an Acer Aspire laptop with a Broadcom wireless card that works with broadcom-wl (I've used the driver for a long time and it works perfectly... with open or WPA networks). The network at my office is WEP. So after installing the drive, adding lib80211 and wl to my MODPROBE (and !b43 !ssb), I reboot and see my wireless as eth0.
    If I try to iwconfig eth0 key XXXX-XXXX-XX or iwconfig eth0 essid WIFINAME key XXXX-XXXX-XX, no matter what combination I try, I get an error saying that it's an invalid argument for SET_ENCODE. I've check the Wiki and man pages for iwconfig, and can't seem to find any solution. Does anyone know why I can't put in a WEP key?
    ((Side note: everytime I've installed Arch, my wifi starts out as eth0 until I get connected and run pacman -Syu. Then I reboot and it shows up as wlan0, and my Atheros ethernet is eth0 or eth1.))

    Thanks for a response. So this is a fresh-from-the-oven install. I usually get my wifi connection set up and then create my user and go about setting everything else up. Meaning I've been trying as root.
    I can see the wireless network with iwlist scan and it shows up as encryption key: on. Also, I tried using each lib80211 mod or some combination thereof in my rc.conf. No dice.
    Lastly, since I didn't include it before, here's the exact error I get when I try to assign a WEP key with iwconfig:
    Error for wireless request "Set Encode" (8B2A) :
    SET failed on device eth0; Invalid argument.
    UPDATE: I can set the key using [x] between key and XXXXXXXXXX. However, any combination I'm trying of essid and key/enc isn't showing up in iwconfig. No errors, but my iwconfig information isn't changing. It's progress... I think.
    UPDATE #2: I can iwconfig eth0 essid linksys (the office next to us) and grab that one (I don't know their password ) and it updates iwconfig, but our own network doesn't update iwconfig when I run iwconfig essid. >.<
    Last edited by mtcupps (2011-06-17 18:20:02)

  • MCB_ is not working correctly to set the keys

    Hi,
    I am using transaction MCB_ to set the transaction keys but the screen comes up with blank blue screen and an error:
    <b>View/table V_TMCLBW can only be displayed and maintained with restrictions</b>
    I then went to SM30 to maintain table V_TMCLBW, bubt it saids the same error with suggestion to do the following:
    •     <b>find the customizing objects for maintenance of the table/view V_TMCLBW with the 'Display Existing Maintenance Objects' button in the maintenance transction SM30, or
    •     go to the IMG via the 'Customizing' button (also in transaction SM30) and make the settings there.</b>
    Has anyone come across this and can help on how to set the keys?
    Thanks
    WF

    Where do you set this? In develop system?
    Try this transaction:
    Use the following menu path: Transaction SBIW -> Settings for Application-Specific DataSources (PI) -> Logistics -> Settings for IBU Retail/CP
    If not and you are in Test or prod system you have to transport this setting (is not automatically).
    Regards,
    Sergio

  • How to set the Key Photo in .Mac Web Gallery ?

    Has anyone managed to set the key photo in a .Mac Web Gallery album ? The key photo is the photo used on the main page of the Web Gallery to illustrate the event.
    In iPhoto, all you do is select in the left column a published .Mac Web Gallery, right-click on the photo you want to set as the key photo, and select "set as key photo".
    In aperture, you can do the same in a project, but this will only set the key photo for your "all projects" view. This key photo is not used when exporting the project to .mac web gallery.
    In all the web galleries I export from Aperture, the first picture is used as the key photo, it's really a problem. Any solution ?
    Message was edited by: skiss

    There is a small "Header Bar" if you will in iPhoto, you can drag the photo you want to that header bar and I think that accomplishes what you want if I understand what you mean by Key Photo (the photo that shows up in e-mail if you forward the gallery to others). My wife and I stumbled on that solution as we were trying to figure it out. Actually I think wife gets the credit, she had the mouse in her hand when it happened .

  • Setting composite key in Container Managed Entity Bean

    In my database table i set primary key to two columns making them as composite key. how do i set that in my container managed entity bean home interface findByPrimaryKey() method and in deployment descriptor file.

    1. create another class (say CompositePK) that will embed the two fields keyA and keyB corresponding to the two pk of your table (declare them public) .
    2. in your Bean declare keyA and keyB public.
    3. in the dd declare your bean primary-key-class as CompositePK and the primary-key-field as keyA and keyB.
    this is the method i use (with BAS) even if the key is simple (such as Integer).

  • How to set Shortcut keys for button in Apex

    Hi
    Could anyone help me on how to set shortcut keys for buttons in Apex.
    I need to use say ALT + S to submit the page.
    The following thread pertaining to HTML DB refered to use ACCESS key. but that couldnt work in my case.
    Re: operation of the app. with the keyboard
    Any pointers on achieving this would be helpful.
    Thanks
    Vijay

    Hi Vijay,
    I’m afraid you must do it using javascript key listener. You can’t use action() on template based buttons because they are actually not HTML buttons but images with hyperlink.
    Key listener checks which key has been pressed down and invoke some JS function. For example, write this code in page header:
    <script>
    document.onkeydown=keyCheck;
    function keyCheck(e){
         var KeyId = (window.event) ? event.keyCode : e.keyCode;
         switch(KeyId){         
              case 113:
                   doSubmit('SAVE');
                   break;                    
              case 118:
                   alert('Hello');
                   break;
    </script>
    This script will submit page with request 'SAVE' if you press F2 or will show alert message if you press F7. Modify it to your issue.
    Regards,
    Przemek

  • How to set primary key for a date column

    hello experts .,
    i need to set primary key for a column consists of the datatype date. how to solve this..?

    1008318 wrote:
    its my personal need..then it is a very bad personal need. DATE is not an appropriate type to be using for a primary key, as it cannot be guaranteed to be unique, especially when inserting multiple rows at once.
    You would be better working to business needs and implementing correct technical solutions to those needs, than to just do things based on your personal needs.

  • Anyone know setting primary key deferred help in the bulk loading

    Hi,
    Anyone know by setting primary key deferred help in the bulk loading in term of performance..cos i do not want to disable the index, cos when user query the existing records in the table, it will affect the search query.
    Thank You...

    In the Oracle 8.0 documentation when deferred constraints were introduced Oracle stated that defering testing the PK constraint until commit time was more efficient than testing each constraint at the time of insert.
    I have never tested this assertion.
    In order to create a deferred PK constraint the index used to support the PK must be created as non-unique.
    HTH -- Mark D Powell --

  • How do i set Shortcut key for activating some operation for JButton

    while using the JButton component,one question is arising in my mind that is
    (1)how to set Shortcut key instead of using JButton actionPerformed event.
    I need a shortcut key for the similar operation has to be performed

    http://java.sun.com/docs/books/tutorial/uiswing/components/button.html

Maybe you are looking for

  • Can not refresh contents of finder windows

    I can not get my finder windows to refresh their contents. My picture folder is the one that really bothers me. When I am trying to upload pictures to the internet, the picture folder is never accurate. I have tried the refresh finder apple script, r

  • Can 23" cinema HD Display support Game systems connectivity

    I currently have my display connected to my MacBook but space is a factor at my dorm. Can I use my Apple 23" Cinema HD Display to connect my xbox 360? I bought a DVI to HDMI adapter but i get no picture. i also have a xbox VGA cable if i need to go t

  • Is it a Bug of JDK?

    JSlider m_Slider = new JSlider(); m_Slider.setMajorTickSpacing( 10 ); m_Slider.setSnapToTicks( true ); when the system use windows lookandfeel,it works properly,but if the system use MetalLookAndFeel, the last sentense doesn't work,I use jdk1.4.1 is

  • After upgrade to 4.3.5

    After upgrade to 4.3.5 I can't use my ipad, it stays with the itunes logo and the USB port. Please help

  • Embedded VIdeo Play Issue in Firefox

    Hi peeps. My OS is Win7 Home Basic 64-bit. I can't play any embedded video in Firefox, but I can in Chrome and IE. The video screen just goes black with circle loading stopped in motion. The tab isn't frozen or not responsive, simply the video wouldn