Geertjan's Blog

  • June 13, 2012

Enhanced Ctrl-Tab File Switcher in NetBeans IDE 7.2

Geertjan Wielenga
Product Manager

Press Ctrl-Tab to toggle the file switcher in NetBeans IDE and you'll see something more expressive when you're using NetBeans IDE 7.2:

As you can see, not only open editor documents are found in the file switcher. Also open view documents, e.g., "Properties" in the screenshot above, are shown. Keep pressing Tab while holding down the Ctrl key or hold down the Ctrl key while pressing up and down to move up and down the list.

However, in addition, you can see that you can now also switch to tabs within file documents. Above, you can see I have selected "ShapeTopComponent.java" which, because it is a GUI component, has three different tabs, "Source", "Design", and "History". By pressing the right arrow key and the left arrow key, I can switch between those different tabs in the switcher, if I am still holding down the Ctrl key. Then, when the I release the Ctrl key, whichever currently selected file, at whatever selected tab, is opened.

All this thanks to JDeveloper, where this enhanced switcher was a requirement. (Read here.)

Related to all of this is the new call "TopComponent.getSubComponents", which was needed to achieve part of the above: "The new method can be used to access for example inner tabs in a multiview window." (Read here.)

Note also that there's a new branding token "WinSys.CtrlTabSwitching.In.JTable.Enabled", to disable Ctrl-Tab window switching when a JTable or a JTabbedPane has input focus, because in those contexts Ctrl-Tab consumes key strokes associated with those components. (Read here and read here.)

A happy side effect for anyone creating their generic desktop applications on the NetBeans Platform is that your users can click Ctrl-Tab to switch between open windows (which in some NetBeans Platform applications can be MANY open windows), even when you don't have any editor documents in your application:

So, thanks to JDeveloper, NetBeans Platform applications all over the world now have a handy window switcher, automatically, without you needing to write a single line of code.

Join the discussion

Comments ( 8 )
  • guest Thursday, June 14, 2012

    Cool gimmick. And this is not even mentioned in http://wiki.netbeans.org/NetBeans_72_NewAndNoteworthy. @Geertjan: Could you add this info to the wiki?

  • Geertjan Friday, June 15, 2012

    It is mentioned there: "The popup window that shows when pressing Ctrl+TAB keys now includes non-document windows (Projects, Navigator etc) and also inner tabs in document windows (Source/Design/History)."

  • Edgar Merino Friday, July 27, 2012

    Hello, I like the new File Switcher, however it has this odd behavior I would like to disable: if you press the Ctrl key and hit the TAB key two times fast, it'll jump to the 3rd document, instead of the 2nd. Is this the expected behavior?

  • krabas Tuesday, August 7, 2012

    I second, pressing ctrl+tab fast twice gives nasty bug.

  • Ryan Thursday, August 23, 2012

    Thanks for this blog entry. I had completely forgotten about this shortcut for switching files.

  • guest Monday, September 24, 2012

    Is there a way to disable new Ctrl-Tab behavior?

    Now this window opens much slower on older CPU and I don't need these new elements in my work.

  • guest Wednesday, January 30, 2013

    Sincerely, I prefer Netbeans 7.1 Ctrl+TAB behavior. What is the purpose of list Properties, Projects, etc tabs when you are pressing Ctrl+TAB when you are in the editor? the obvious purpose of use Ctrl+TAB is to change the current document and must accomplish this task as efficient as possible.

    Also, with this approach, user loose possibility to view old documents in history using multiple columns and select/view it faster if he/she need that. Now, if user has to many documents opened, needs to hold Ctrl+TAB to, slowly, find an old document in Ctrl+TAB list (with the risk to get focus on the no-sense second column, an odd behavior.)

    I guess a better design is to allow multiple column file list when you press Ctrl+TAB and don't allow the possibility to change into Source, History, Design, etc; this allow a more compact columned list and strip a hard to use feature and maximize the document efficiency.

  • guest Thursday, September 12, 2013

    This new "feature" is shit. ctrl tab should go to the next goddamn tab.

Please enter your name.Please provide a valid email address.Please enter a comment.CAPTCHA challenge response provided was incorrect. Please try again.