Override "crtl + tab" key behaviour with "tab" key for JtextArea .

I am trying to override the "crtl + tab" key behaviour for JTextArea with "tab" key plus add my own action. I am doing the following.
1. Setting Tab as forward traversal key for the JTextArea (the default traversal key from JTexArea is "crtl + Tab").
2. Supplementing the "crtl + Tab" key behaviour with my custom behaviour.
For the point 2 above, I need to get hold of the Action represented by the "crtl + Tab" key so that I could use that and then follow with my own custom action. But the problem is that there is no InputMap entry for "crtl + tab". I dont know how the "crtl + tab" key Action is mapped for JTextArea. I used the following code to search the InputMap.
            System.out.println("Searching Input Map");
            for (int i = 0; i < 3; i++) {
                InputMap iMap = comp.getInputMap(i);
                if (iMap != null) {
                    KeyStroke [] ks = iMap.allKeys();
                    if (ks  != null) {
                        for (int j = 0;j < ks.length ;j++) {
                            System.out.println("Key Stroke: " + ks[j]);
            System.out.println("Searching Parent Input Map");
            for (int i = 0; i < 3; i++) {
                InputMap iMap = comp.getInputMap(i).getParent();
                if (iMap != null) {
                    KeyStroke [] ks = iMap.allKeys();
                    if (ks  != null) {
                        for (int j = 0;j < ks.length ;j++) {
                            System.out.println("Key Stroke: " + ks[j]);
            }In short, I need to get the Action associated with the "crtl + tab" for JTextArea.
regards,
nirvan.

There is no Action for Ctrl+TAB. Its a focus traversal key.

Similar Messages

  • Customize "Tab" key for JTextArea to focus next component.

    Hi,
    I am trying to change the "TAB" key behaviour for JTextArea, by using CustomAction configured via InputMap() and ActionMap(). When the user presses the Tab key, the focus should go the next component instead of tabbing in the same JTextArea component. Here is the code for the CustomAction().
        public static class CustomTabAction extends AbstractAction {
            private JComponent comp;
            public CustomTabAction (JComponent comp) {
                this.comp = comp;
                this.comp.getInputMap().put(KeyStroke.getKeyStroke("TAB"), "TABPressed");
                this.comp.getActionMap().put("TABPressed", this);
            public void actionPerformed(ActionEvent evt) {
                Object source = evt.getSource();
                if (source instanceof Component) {
                    FocusManager.getCurrentKeyboardFocusManager().
                            focusNextComponent((Component) source);
        }This works for most of the cases in my applicaiton. The problem is that it doesn't work with JTable which has a custom cell editor (JTextArea). In JTextArea field of JTable, if the Tab is pressed, nothing happens and the cursor remains in the custom JTextArea exactly at the same place, without even tabbing spaces. Here is the CustomCellEditor code.
        public class DescColCellEditor extends AbstractCellEditor implements TableCellEditor {
    //prepare the component.
            JComponent comp = new JTextArea();
            public Component getTableCellEditorComponent(JTable table, Object value,
                    boolean isSelected, int rowIndex, int vColIndex) {
                // Configure Tab key to focus to next component
                CustomActions.setCustomAction("CustomTabAction", comp);
                // Configure the component with the specified value
                ((JTextArea)comp).setText((String)value);
                // Return the configured component
                return comp;
            // This method is called when editing is completed.
            // It must return the new value to be stored in the cell.
            public Object getCellEditorValue() {
                return ((JTextArea)comp).getText();
        }regards,
    nirvan

    >
    textArea.getInputMap().remove(....);but that won't work because the binding is actually defined in the parent InputMap. So I think you need to use code like:
    textArea.getInputMap().getParent().remove(...);But I'm not sure about this as I've never tried it.I tried removing the VK_TAB key from both the input map and parent input map as shown below. But I still have to press "TAB" twice in order to get out of the JTextArea column in JTable.
                comp.getInputMap().getParent().remove(
                            KeyStroke.getKeyStroke(KeyEvent.VK_TAB,0));
                comp.getInputMap().remove(
                            KeyStroke.getKeyStroke(KeyEvent.VK_TAB,0));after coding this, I am using the setFocusTraversalKeys for adding only "TAB" key as ForwardTraversalKey as given below.
            Set newForwardKeys = new HashSet();
            newForwardKeys.add(KeyStroke.getKeyStroke(KeyEvent.VK_TAB, 0));
            comp.setFocusTraversalKeys(
                        KeyboardFocusManager.FORWARD_TRAVERSAL_KEYS,newForwardKeys);
            Set newBackwardKeys = new HashSet();
            newBackwardKeys.add(KeyStroke.getKeyStroke(KeyEvent.VK_TAB, KeyEvent.SHIFT_DOWN_MASK));
            comp.setFocusTraversalKeys(
                        KeyboardFocusManager.BACKWARD_TRAVERSAL_KEYS,newBackwardKeys);The only problem that remains now is that I have to press the "TAB" twice in order to get out of the JTextArea column
    regards,
    nirvan.

  • Unable to operate tab shortcut keys for safari

    I am using Safari 4.0.2.
    All is working good except the *Tab shortcuts for safari*.
    Problem: Tab shortcuts does not work every time. It works very less time.
    *What I did to solve the problems?*
    1) Re-Checked the necessary shortcuts in the preferences pane but nothing happened.
    2) Re-installed Safari
    3) Also did reset to Safari.
    I did not understand what has happened to it.
    Please help me with it.

    Hi
    Welcome to Apple Discussions
    A corrupt preference file may be causing the Command T problem, or perhaps you created a keyboard shortcut for Command/T.
    If you didn't alter the keyboard shortcuts, trash the preference file.
    Via the Finder: Your User Account>Library>Preferences folder. Move the com.apple.safari.plist file to the trash, then restart Safari. This resets Safari preferences to default values. Restore any custom settings in either the Preference panel, Edit Menu (spelling), or View Menu. Also, restore any custom icons on the toolbar via the Customize Toolbar option.
    Also, the reset adds Apple default bookmarks to your Bookmarks collection (command/option/B keys). Delete any you don't want.
    Post back

  • No question.  I just wanted to thank whomever told me to hit the TAB key for resolving my issue.  I guess I must have inadvertently hit TAB without realizing it.  Thank you very much!

    No question.  I just wanted to thank whomever told me to hit the TAB key for resolving my issue.  I guess I must have inadvertently hit TAB without realizing it.  Thank you very much!

    I'm not sure if I did anything to cause this; if I did, I don't know how to undo it.  The format of my library screen has changed.  Across the whole screen is a group of 3 photos from my last import, with the one I have chosen highlighted.  I can still se

  • Ip sla operations with different keys for the same destination

      Hi all,
    the customer wants to use different ip sla operations for the same destination (ip sla responder). From the first source router he uses key key1 and from the second source router he uses key key2. The ip sla responder responds only for the first router which uses the key key1.:-( Is it a normal behaviour? Can I use different keys for different ip sla operations for the same ip sla responder?
    See the configuration on the responder:
    key chain test
    key 1
      key-string 7 *key1*
    key 2
      key-string 7 *key2*
    ip sla key-chain test
    ip sla responder
    He tried to use ip sla responders on:
    Ciscu 2911
    Cisco IOS Software, C2900 Software (C2900-UNIVERSALK9-M), Version 15.2(4)M3, RELEASE SOFTWARE (fc2)
    Cisco 881
    Cisco IOS Software, C880 Software (C880DATA-UNIVERSALK9-M), Version 15.1(4)M4, RELEASE SOFTWARE (fc1)
    Thank you.
    Roman

    Thomas,
    Have a look at:
    http://www.cisco.com/en/US/docs/ios-xml/ios/sec_conn_dmvpn/configuration/15-2mt/sec-conn-dmvpn-share-ipsec-w-tun-protect.html#GUID-2B448241-FD10-4F3B-BFF8-DFD44982D235
    If you're using one tunnel source you need to use one ipsec profile, unless you're running (a) p2p tunnel which you're not in this case.
    While you MAY have some luck with sharing/unsharing among different interface I'm afarid it will not be ever mentioned as supported.
    The situation will change with upcomfing 3.10 and 3.11 IOS XE releases (and corresponding IOS releases).
    M.

  • Overriding Oracle Default keys

    I want to override my function keys with the routine i want to be executed when my program is running. I've tested to define it in the resource file but nothing happens... <the oracle documentation may not defining it well..>
    Any suggestions on the steps to do it?

    hello
    i dont know if i understood your question but can use the null command
    if you want to want to overwrite the F7 key .
    create a trigger called key-exec_qry with 'null;'

  • Apple keyboard software overrides QuarkXpress function keys

    HELP
    I recently installed Tiger 10.4.11 update, and the apple keyboard software update 1.2 for use with a new Apple keyboard. However, in QuarkXpress 6.5, now the function keys F7 and up do not work in Quark — presumably because they are being used by the keyboard software. I presumed when an application was running (e.g., Quark) IT would override. I need my F7 key in Quark!
    Is there a way to make the application take precedence? Or, is there a way to disable or uninstall the apple keyboard software? The function keys for use with itunes and dashboard, etc. are far less important to me than having the function keys available in software I use daily for work.
    Thanks so much!
    jelcroy

    Thanks for the reply — I tried that, which seemed the obvious solution, but I cannot find the place to change that — it is NOT in the keyboard shortcut list in the keyboard preferences.
    The F7 thru F9 keys on the new keyboard control playback, which I presume to be itunes and\or DVD player, judging from the icons on those keys.
    Haven't found a place to disable them. In adding apps in the keyboard shortcuts, which I tried, it doesn't allow for the key combinations needed to restore the Quark functionality I am missing since the keyboard software update, which I wish I hadn't done. There's not enough functionality in the keyboard that isn't available in a myriad of other ways to make it worthwhile, especially when it means giving up the convenience if those commands in Quark, which is where I spend the majority of my time.
    Anyone have other ideas? Can the Apple keyboard software be uninstalled or disabled?
    BTW, the control F1 command to turn off keyboard access doesn't work either.

  • Best Practice loading Dimension Table with Surrogate Keys for Levels

    Hi Experts,
    how would you load an Oracle dimension table with a hierarchy of at least 5 levels with surrogate keys in each level and a unique dimension key for the dimension table.
    With OWB it is an integrated feature to use surrogate keys in every level of a hierarchy. You don't have to care about
    the parent child relation. The load process of the mapping generates the right keys and cares about the relation between the parent and child inside the dimension key.
    I tried to use one interface per Level and created a surrogate key with a native Oracle sequence.
    After that I put all the interfaces in to one big Interface with a union data set per level and added look ups for the right parent child relation.
    I think it is a bit too complicated making the interface like that.
    I will be more than happy for any suggestions? Thank you in advance!
    negib
    Edited by: nmarhoul on Jun 14, 2012 2:26 AM

    Hi,
    I do like the level keys feature of OWB - It makes aggregate tables very easy to implement if your sticking with a star schema.
    Sadly there is nothing off the shelf with the built in knowledge modules with ODI , It doesnt support creating dimension objects in the database by default but there is nothing stopping you coding up your own knowledge module (use flex fields maybe on the datastore to tag column attributes as needed)
    Your approach is what I would have done, possibly use a view (if you dont mind having it external to ODI) to make the interface simpler.

  • Using javascript to override  pressing function keys (f1,f3,f6,f7,....)

    hi all i wonder if there is a way to to override pressing function keys(f1,f3,f6,f7,....) in adf page for all of the page not just for an input text .
    in another way can i make a client listener for a <f:view> or <af:document> so the javascript function will be called when i preses any button in keyboard without focusing in inputtext or a command button
    Edited by: user554540 on 22/06/2010 03:03 ص

    Hi,
    the problem is that keyboard events are only raised from input components. client listeners can only added to ADF Faces components and af:document does not accept keyboard entries. However, I tried
    af:document > panelStrechtLayout (center facet) > panelGroupLayout (scroll) and assigned a clientListener. At runtime has the desired effect
    Frank
    Edited by: Frank Nimphius on Jun 22, 2010 6:27 PM

  • Blocking cookies - I was told there was a cookie tab under Privacy with a choice for EXCEPTIONS - but 3.6.12 doesn't have it - how do I block a cookie that keeps coming back

    Blocking cookies -
    I was told there was a cookie tab under Privacy with a choice for EXCEPTIONS
    - but 3.6.12 doesn't have it
    - how do I block a cookie that keeps coming back
    using 3.6.12

    To see all the History and Cookie options, select: Tools > Options > Privacy > History: Firefox will: "Use custom settings for history"
    See:
    * [[Blocking cookies]]
    * [[Enabling and disabling cookies]]

  • I have logic pro studio 8 and the upgrade, however it will not upload on my mac book pro. It says i need a product key for the logic 9 and it come with one.

    I have logic pro studio 8 and the upgrade (logic pro 9) and it will not load up to my new mac book pro.  Its asking for a product key for the logic pro 9 upgrade and there wasn't one in the box.  i need some help

    Contact AppleCare... Explain you are a Logic User and you should be transfered to a Product Specialist to assist you with your Issue.

  • Looking for answer keys for "Object First with Java"

    Where can I find a book with anwser keys for the book " Object First with Java" Third Edition?

    zxcvbnm wrote:
    Where can I find a book with anwser keys for the book " Object First with Java" Third Edition?This ought to be an interesting thread. :)

  • How do you override the WINDOWS key?

    I'm writing or rather rewriting a game. I would like to override the windows key to do some function in the game without invoking the windows menu. Is this possible, and if so how?
    Below is a sample bit of code I used to see what key codes, locations, and events were fired while pressing various keys. I made the key pressed/typed/released methods consume the events in an attempt to block the windows menu from coming up. I tried using a KeyEventDispatcher to catch all key events and consume them there, but it still displays the windows menu (on Windows 2000 at least).
    I have searched the forums and the all mighty Google to no avail. Please help me if you can. Thank you.
    import java.awt.Dimension;
    import java.awt.KeyEventDispatcher;
    import java.awt.event.KeyEvent;
    import java.awt.event.KeyListener;
    import java.awt.event.WindowAdapter;
    import java.awt.event.WindowEvent;
    import javax.swing.FocusManager;
    import javax.swing.JFrame;
    public class Test extends JFrame implements KeyListener, KeyEventDispatcher
      public Test()
        this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        addWindowListener(new WindowAdapter()
          @Override
          public void windowClosing(WindowEvent windowEvent)
            System.exit(0); //close all windows and exit
        FocusManager.getCurrentManager().addKeyEventDispatcher(this);
        this.addKeyListener(this);
        this.pack();
      public static void main(String[] arguments)
        Test frame;
        frame = new Test();
        frame.setTitle("Test Frame");
        frame.setPreferredSize(new Dimension(200,200));
        frame.invalidate();
        frame.pack();
        frame.setVisible(true);
      // this doesn't stop windows key from being processed whether true or false
      // if it is true the keyPressed, keyTyped, and keyReleased don't get called
      public boolean dispatchKeyEvent(KeyEvent keyEvent)
        System.out.println("dispatchKeyEvent " + keyEvent);
        return true;
      public void keyPressed(KeyEvent keyEvent)
        System.out.println("keyPressed " + keyEvent);
        keyEvent.consume();
      public void keyReleased(KeyEvent keyEvent)
        System.out.println("keyReleased " + keyEvent);
        keyEvent.consume();
      public void keyTyped(KeyEvent keyEvent)
        System.out.println("keyTyped " + keyEvent);
        keyEvent.consume();
    }

    Thanks for the reply. That is basically all I wanted to confirm. I wanted to allow the player to redefine the windows key to some game specific command. I can do this for all of the other keys I was able to test except for that one.
    If someone uses it on something other than windows they can redefine any key that maps to one of theirs. Since I don't have any alternate systems or keyboards to test on I won't bother making other keyboard configurations for the time being, if ever.

  • Problems with fuction keys for brightness

    i have laptop hp 15 r006tx Product number: G8D30PA#ACJ 
    i have problems with functions keys for brightness , actually it does't works i can't actually adjust brightness, please help me.....................

    OK...
    I was right.  You have no graphics driver installed for the Intel HD graphics adapter.
    I am very surprised you were able to install the nVidia driver because usually you get an error that states you need to install the Intel graphics driver first.
    Once you install this driver, the Microsoft Basic Display adapter should be replaced by an Intel HD graphics adapter and you should be able to adjust the screen brightness.
    Make sure you have installed this Intel chipset driver first and reboot.  If you have done this already, you can skip this step.
    http://h10025.www1.hp.com/ewfrf/wc/softwareDownloadIndex?softwareitem=ob-130504-1&cc=us&dlc=en&lc=en...
    Next, install the Intel HD graphics driver and reboot.  This driver is for W8.1.  If you installed W8, you need a different graphics driver.
    http://h10025.www1.hp.com/ewfrf/wc/softwareDownloadIndex?softwareitem=ob-130257-1&cc=in&dlc=en&lc=en...

  • Can I get product key for older versions of Illustrator with Creative Cloud Student and Teacher edition

    I have purchased the Creative Cloud Student and Teacher edition and I now need to install illustrator on Windows Vista. All the new versions are not available for Vista. I have managed to find older versions for download but it is asking me for a product key. Is it possible to get the product keys for older version with Creative Cloud Student and Teacher edition?

    You cannot purchase older versions of Adobe software thru Adobe.  If you have a full subscription you can acquire the CS6 version  thru that.  I have had CS6 running on a Vista system for years without problems.
    Download previous versions of Adobe Creative applications -
    http://helpx.adobe.com/creative-cloud/kb/download-previous-versions-creative-applications. html

Maybe you are looking for