How to override traversal keys CTL-TAB and CTL-SHIFT-TAB in JSplitpane?

Recently added a JSplitpane to a frame with a number of other panels. One of those panels has two actions triggered by CTL-TAB and CTL-SHIFT-TAB. Since adding the JSplitpane those actions no longer trigger, apparently because JSplitPane is ManagingFocusForwardTraversalKeys and ManagingFocustBackwardTraversalKeys.
I found if I disable the splitpane that the original actions are triggered, but that disables the divider.
What would be the recommended way to change the behavior of a JSplitpane to ignore CTL-TAB and CTL-SHIFT-TAB?
This is a list of things I have tried:
bodySplitPane.getInputMap().remove(KeyStroke.getKeyStroke(KeyEvent.VK_TAB, InputEvent.CTRL_MASK));
bodySplitPane.getInputMap().remove(KeyStroke.getKeyStroke(KeyEvent.VK_TAB, InputEvent.CTRL_MASK | InputEvent.SHIFT_MASK));
bodySplitPane.getActionMap().remove("focusOutForward");
bodySplitPane.getActionMap().remove("focusOutBackward");
bodySplitPane.setFocusTraversalKeysEnabled(false); // doesn't work
bodySplitPane.setFocusTraversalKeys(0,new HashSet<KeyStroke>());
bodySplitPane.setFocusTraversalKeys(1,new HashSet<KeyStroke>());
bodySplitPane.enableInputMethods(false);
//bodySplitPane.setEnabled(false); // false allows ctl-tab to pass through but freezes the divider so it can't be moved via mouseThanks in advance.
Jeff
Edited by: 837741 on Dec 6, 2012 1:11 PM
Edited by: 837741 on Dec 6, 2012 1:13 PM

Found this in the tutorial (http://docs.oracle.com/javase/tutorial/uiswing/misc/keybinding.html) which solved the problem for me:
bodySplitPane.getInputMap(JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT).put(KeyStroke.getKeyStroke(KeyEvent.VK_TAB, InputEvent.CTRL_MASK),"none");
bodySplitPane.getInputMap(JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT).put(KeyStroke.getKeyStroke(KeyEvent.VK_TAB, InputEvent.CTRL_MASK | InputEvent.SHIFT_MASK),"none");Turns out my left splitpane has no focusable components, but might be that if it did I would have needed to set the action in the other two input maps as well like this:
bodySplitPane.getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW).put(KeyStroke.getKeyStroke(KeyEvent.VK_TAB, InputEvent.CTRL_MASK),"none");
bodySplitPane.getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW).put(KeyStroke.getKeyStroke(KeyEvent.VK_TAB, InputEvent.CTRL_MASK | InputEvent.SHIFT_MASK),"none");
bodySplitPane.getInputMap(JComponent.WHEN_FOCUSED).put(KeyStroke.getKeyStroke(KeyEvent.VK_TAB, InputEvent.CTRL_MASK),"none");
bodySplitPane.getInputMap(JComponent.WHEN_FOCUSED).put(KeyStroke.getKeyStroke(KeyEvent.VK_TAB, InputEvent.CTRL_MASK | InputEvent.SHIFT_MASK),"none"); Contrary to what the tutorial says, "none" seems to work as the action for any of the input maps, and "nil" or any string seems to work. I found no need to define an action class as the tutorial states and the tutorial does not show any use of the action inner class.
Also found this helpful http://www.ibm.com/developerworks/java/jdk/additional/IBM50KeyBindings.html
Edited by: 837741 on Dec 7, 2012 7:25 AM

Similar Messages

  • Regarding ctrl-tab and ctrl-shift-tab

    hi,
    i have a JFrame inside which i have a JInternalFrame and this contains 4 JPanels
    which have components now,
    when i press ctrl-tab from first panel's component the focus should move to
    first component of next panel same from other panels and ctrl-shift-tab - reverse
    how can i achive it ?
    i extended FocusManager and by overriding processKeyEvent() i was able achieve what a wanted
    but i have many JInternalFrames which are entirely diffenent from each other
    so had to have different FocusManagers .
    after setting new focusmanager the Mnemonic of JFrame were not working .
    so i need any work arounds for the above problem.
    desperately need help.
    thanks.

    Hi,
    It should work. In the case, don't minimize the Book3.xlsx's window. Then you should be able to use Ctrl+Tab and Ctrl+F6 to switch between the book1,2 and 3.
    Because Excel 2013 move to a single document interface, so there is no workbook title bar minimize, maximize, and close buttons. When you minimize the Book3's window in Excel 2013, the action will be treated as you have used the workbook title
    bar minimize button to minimize the workbook.  
    In Excel 2010, the buttons can be found here:
    If you use the workbook title bar minimize button in Excel 2010 instance, the same behavior can be reproduced.
    Best regards,
    Rex Zhang
    TechNet Community Support

  • Focus Travel in the JInternalFrames (ctrl+tab and ctrl+shift+tab)

    hi ,
    i have a JFrame inside which i have a JInternalFrame.
    in this JInternalframe I have 4 JPanels when I click ctrl-tab from a JFrame the focus should go to
    next panel'sand similar for other panels vice-verse ctrl-shift-tab .
    how to achieve this .
    looking for help.
    Thanks in Advance

    According to my [Key Bindings|http://www.camick.com/java/blog.html?name=key-bindings] program those keys are already mapped to the next/previous frame Action.
    However, the problem seems to be that the KeyboardFocusManager is intercepting the KeyStroke so you need to remove those KeyStrokes from the focus traversal set. I don't know how to do that, but you can create a new set:
    Set set = new HashSet();
    set.add( KeyStroke.getKeyStroke( "TAB" ) );
    frame.setFocusTraversalKeys( KeyboardFocusManager.FORWARD_TRAVERSAL_KEYS, set );You will need to use similiar code for the backward traversal keys.

  • How to extract all keys (PK, FK) and constraints from the schema?

    hi,
    How to extract all keys (PK, FK) and constraints from the schema?Thanks!

    I have no idea about any tool which only extract the DDL of constraints.
    In oracle 9i or above you can use DBMS_METADATA to extract DDL of a table which also shows contraints defination.
    You can take the tables export without data and use databee tool to extract the DDL.
    www.databee.com

  • App tabs and web page tabs not saved when Apple Mac is powered down

    Using Firefox with Apple Mac running OS X v 10.7.1 and Parallels 6, and Windows Vista as a virtual computer. Have Firefox 6.o installed on the Mac and Firefox 6.0 for Windows installed within Microsoft Vista running under Parallels 6 as a virtual machine.
    Issue 1) Within Mozilla on the Mac whenever I power down and restart the computer all my app tabs and web page tabs are lost except for my home page, even though I have set up Firefox preference to remember my open web pages/tabs.
    Issue 2) Within Firefox running within Vista on the virtual machine my web pages are remembered but I cannot figure out how to create a app tab.

    Tabs are only saved if you close (Firefox > Quit) the Firefox application while those tabs are still showing. If you close a window and still have the menu bar visible then you wont reopen already close tabs. You may need to be able to reopen the three last closed windows via History > Recently closed Windows.

  • When I set up an App Tab the original tab and the App Tab are both there when Firefox opens next time

    When I set up an App Tab the original tab and the App Tab are both there when Firefox opens next time. I have tried saving the current tabs, etc but that doesn't help.

    I had this problem after I installed an update for Java. Firefox also stopped remembering my open tabs from last time. I disabled all of the Java plug-ins, restarted, and it's worked great ever since. Haven't missed Java yet either.

  • Help,add button to contracts overview tab and the HEADER tab

    Hello,
    I would like add button to contracts overview tab and the HEADER tab .
    Do you want to change the standard procedure?
    /SAPSRM/WDC_CTR_DOFC_OV_H?
    Are there any other way?

    Hi,
    You can create a enchancement implemenation for /SAPSRM/WDC_CTR_DOFC_OV_H  and /SAPSRM/WDC_CTR_DODC_H_BD  by clicking on 'snail icon' .
    Creating button as per requirment. coding in  method on action of that button.
    Regards,
    Neelima

  • How to change the homepage for a new tab when the home page of the initial tab and subsesequently opened tab are different?

    When iam using firefox i selected google as my home page. But while opening another tab in the same window(ctrl+T), I am getting babylon search as home page for it. How can i get rid of this problem?

    '''''"...while opening another tab in the same window(ctrl+T), I am getting babylon search as home page for it."""
    Any search toolbar and changes to search engines can take place by downloading and installing software; usually "free" software from the internet. Babylon can be downloaded and installed by itself or as a "ride-along" when installing/updating some software from the internet. Always look for an opportunity during the installation to un-check boxes that will install "ride-along" items that you do not want. Firefox installation does not include such "ride-along" items.
    #Remove Babylon Toolbar (if you have it installed). The most complete removal is to remove it from your system using (Windows) Control Panel > Add or Remove Programs): http://kb.mozillazine.org/Uninstalling_toolbars#Uninstalling_via_Windows_Control_Panel<br />
    #*Also see:
    #**http://support.mozilla.com/en-US/kb/Uninstalling+add-ons
    #**http://support.mozilla.com/en-US/kb/Cannot%20uninstall%20an%20add-on
    #**http://kb.mozillazine.org/Uninstalling_toolbars
    #Reset your home page (if the Babylon search page is displayed when starting Firefox): http://support.mozilla.com/en-US/kb/How+to+set+the+home+page
    #*You can reset to the default by clicking "Restore to default" on Options > General > Startup > Home page. Be sure to set "When Firefox starts" to "Show my home page" on that same panel.
    #Reset your Location Bar search engine (if typing a few words in the URL/Location Bar takes you to Babylon search):
    #*type '''''about:config''''' in your Location Bar, like typing a web site address, and press the Enter key
    #*ignore warning and choose to continue
    #*in Filter, type '''''keyword.URL'''''
    #*in lower part of screen, if it is '''bold''' and shows "'''user set'''", right-click keyword.URL and choose "Reset"
    #*in Filter, type '''''babylon'''''
    #*any items in lower part of screen in '''bold''' and showing "'''user set'''", right-click and choose "Reset"
    #*close about:config tab
    #*See:
    #**http://kb.mozillazine.org/About:config
    #**http://kb.mozillazine.org/Location_Bar_search#Location_Bar_search_.28external_-_search_engine.29
    #**http://kb.mozillazine.org/Keyword.url
    #**http://www.techrena.net/computers/address-bar-search-provider-firefox/
    #If Babylon is shown in your Search Bar and you want to remove it:
    #*https://support.mozilla.com/en-US/kb/Search%20bar
    '''If this reply solves your problem, please click "Solved It" next to this reply when <u>signed-in</u> to the forum.'''
    Not related to your question, but...
    You may need to update some plug-ins. Check your plug-ins and update as necessary:
    *Plug-in check --> http://www.mozilla.org/en-US/plugincheck/
    *Adobe Shockwave for Director Netscape plug-in: [https://support.mozilla.com/en-US/kb/Using%20the%20Shockwave%20plugin%20with%20Firefox#w_installing-shockwave Installing ('''''or Updating''''') the Shockwave plugin with Firefox]
    *Adobe PDF Plug-In For Firefox and Netscape: [https://support.mozilla.com/en-US/kb/Using%20the%20Adobe%20Reader%20plugin%20with%20Firefox#w_installing-and-updating-adobe-reader Installing/Updating Adobe Reader in Firefox]
    *'''''Shockwave Flash''''' (Adobe Flash or Flash): [https://support.mozilla.com/en-US/kb/Managing%20the%20Flash%20plugin#w_updating-flash Updating Flash in Firefox]
    *Next Generation Java Plug-in for Mozilla browsers: [https://support.mozilla.com/en-US/kb/Using%20the%20Java%20plugin%20with%20Firefox#w_installing-or-updating-java Installing or Updating Java in Firefox]

  • How to Lock a Transaction for Editing AND VERY minor tab cont. help

    Just two things I need to ask about
    <b>1. How to Lock a Transaction for Editing</b>
    I am currently using the fcode ENQUEUE_E_TABLE. The function works as once the transaction in opened, another cannot access it.
    However, I have two modes in my transction (Display and Edit). <u> What I need to do is If another user has already opened the transaction, the other user can still access the transaction but cannot access the edit mode.</u>
    <b> 2. VERY minor tab cont. help </b>
    I noticed in a table control is being used in a transction you can resize a colunm. <u> How do you disable this </b>?
    and <u> how do you resize the horizontal scroll bar </u> so that you can limit scrolling upto the point where there are field columns?
    Thanks for you help ppl and take care

    Hi chad,
    This link will help u know abty different types of locks that are available:
    http://help.sap.com/saphelp_erp2005/helpdata/en/7b/f9813712f7434be10000009b38f8cf/frameset.htm
    For resizing all u can go to the table settings and u can do it.
    Hope tis helps u,
    Regards,
    Nagarajan.

  • Aluminum Keyboard keys "n", "y", and right "shift" not working

    My cat knocked over a glass of water on my desk, and while the keyboard attached to my MacBook didn't get water directly into it from the top, it was eventually surrounded in water. It's now dry, and everything works ok except for the N Y and right SHIFT keys. Has this happened to anyone else? Do you know how to fix it? I've tried in in my MacBook Pro and the same keys don't function. I've just tried taking a hairdryer to it to no avail.
    Any other suggestions? Perhaps its time to buy the wireless version afterall.
    Thanks!
    D.

    No real suggestion than to let it dry out more. If it was just water then there's a decent chance that it will "probably" work.
    You might have a look at Removing the individual keys. I wouldn't suggest actually trying to take it apart!

  • Down Arrow key stopped working and the Shift 2 for "@" stopped working?

    Only had the MacAir for a Month.
    Other arrow keys work fine. then the Shift 2 "@" won't work now.
    What the route for fixing this problem

    Hi BGreg,
    Thanks for your speedy reply! That document is useful however how do I get the keycap off, as it only explains how to get the keycap back on. Again I've had a look for info pertaining to getting the key off and haven't found anything, does anyone know where this document is?
    As a side note was in a store today looking at the latest 17" macbook pro. Soooooo nice. Think it might be time for an upgrade next year!

  • Tabs and Pages::: All tabs are displayed at once

    Hi, In my application I have around 100+ pages and grouped together based on specific category. I have a one level tab page as default, and I have grouped the tabs based on the category.
    I displayed the tabs when contained in a comma separated page numbers. Then I wanted put these pages in a table and display the tabs when a specific page is selected.
    Ex:
    pages :1,2,3,4,5 :
    Group 1
    for display: I used pl/sql return boolean with the following function==== return pagetabs(v('APP_PAGE_ID'))
    create or replace function pagetabs (vpageid in number) return boolean is
    begin
    for crec in select a.pagenum from auditor_pages a, auditor_pages b where b.pagenum=vpageid and a.pagegroup=b.pagegroup
    loop
    if crec.pagenum = vpageid then
    return TRUE;
    end if;
    end loop;
    return False;
    end pagetabs;
    The problem:
    I have all the tabs displayed all the time. My idea is to get the tabs related to that page depending on the category. Can some one suggest a better method or tell me what is the mistake in this process

    If it works in Safe Mode and in normal mode with all extensions (Firefox/Tools > Add-ons > Extensions) disabled then try to find which extension is causing it by enabling one extension at a time until the problem reappears.
    Close and restart Firefox after each change via "Firefox > Exit" (Windows: Firefox/File > Exit; Mac: Firefox > Quit Firefox; Linux: Firefox/File > Quit)
    *https://support.mozilla.org/kb/Troubleshooting+extensions+and+themes
    In Firefox Safe mode these changes are effective:
    *all extensions are disabled (about:addons)
    *default theme is used (no persona)
    *userChrome.css and userContent.css are ignored (chrome folder in profile folder)
    *default toolbar layout is used
    *JavaScript JIT compilers are disabled
    *hardware acceleration is disabled (Options > Advanced > General)
    *plugins are not affected
    *preferences are not affected

  • Hi, I just updated to ff6, when i open a new browser the tab bar is missing....however when i hit Ctrl+T i get the tab bar back with the original tab and the new tab. I have box checked in options "always show the tab bar". Any help greatly appreciated

    Using Windows XP and Firefox 6....tab bar has gone missing but returns when i open a second tab. I used to be able to open a browser which opened my bookmarked homepage and I cold then click the + to the right of this tab and open a new tab.

    hello, please install the search reset addon - it will revert the most common customizations those adware programs do in firefox back to the default: https://addons.mozilla.org/firefox/addon/searchreset/

  • When I right click and "Search Google for ____" the resulting google search comes up in a new tab AND the current tab

    Right click google search used to open only in a new tab. Now it opens in a new tab and after a moment, the current tab also.
    Any ideas?

    Start Firefox in <u>[[Safe Mode]]</u> to check if one of the extensions or if hardware acceleration is causing the problem (switch to the DEFAULT theme: Firefox (Tools) > Add-ons > Appearance/Themes).
    *Don't make any changes on the Safe mode start window.
    *https://support.mozilla.org/kb/Safe+Mode

  • Open All in Tabs, opens bookmarks in new tabs and leaves current tab open instead of changing to the first bookmark

    Whenever I click the "Open All in Tabs", it opens all the bookmarks in new tabs instead of opening the first bookmark in the current tab and the rest in new tabs.
    happens on all 3 of my computers running 8.0a1

    This isn't possible anymore, due to the fact that this Boolean entry has been removed: https://bugzilla.mozilla.org/show_bug.cgi?id=395024
    <br />
    In my Firefox Aurora 8.0a2 (Windows 7, but Ubuntu 10.10 as well) the current behaviour could be described as follows: <br />
    Open all in tabs
    <ul><li>Normal click: opens all in new tabs, changes focus to first one opened;</li>
    <li>Ctrl + click: opens all in new tabs, changes focus to first one opened;</li>
    <li>Shift + click: opens all in new window, changes focus to first one (tab) opened;</li>
    <li>Ctrl + Shift + click: opens all in new tabs, doesn't change focus.</li></ul>
    <br />
    Whereas I would like it to be as follows: <br />
    Open all in tabs
    <ul><li>Normal click: opens all but the first one (which overwrites current) in new tabs, doesn't change focus (due to the fact that the first item is already in the focused tab); in short, it changes the currently focused to the first item from the folder and appends its' rest on the right side;</li>
    <li>Ctrl + click: opens all in new tabs, doesn't change focus;</li>
    <li>Shift + click: opens all in new window, changes focus to the first one (tab) opened;</li>
    <li>Ctrl + Shift: opens all in new tabs, doesn't change focus.</li></ul>
    <br />
    This behaviour was present a few versions ago and only lately have I looked for the solution to this. I encountered many bug files regarding this topic with people speaking against Firefox's behaviour that would close existing tabs when opening all in new tabs (from a folder), which possibly influenced the change that I would like to be reverted.
    <br />
    Please let me know if it is possible to attain the behaviour I described.

Maybe you are looking for