Skip to main content

Spicing up your JTabbedPane - part V

Posted by kirillcool on June 20, 2006 at 1:36 PM PDT

This is the fifth part of the series that describes the additional capabilities that you can get on your tabbed panes.

  • The first part described close buttons and animation on modified tabs
  • The second part described vetoable close buttons and vertical tabs.
  • The third part described single-click close of multiple tabs and custom alignment of tab texts on left and right placement.
  • The fourth part described hover preview popup and tab overview dialog.

This entry describes the new feature available in the next version of Substance look-and-feel (code-named Grenada) and any other third-party LAF using laf-widget layer.


First, you're welcome to read this blog entry that introduces the notion of widget into the world of look-and-feels. While Substance LAF is currently the only LAF supporting the "feel" widgets, the approach has been successfuly tested on six other third-party LAFs (Squareness, Pagosoft, Looks, Liquid, Infonode and Napkin. While the previous four parts described Substance-specific features, the introduction of laf-widget now allows additional third-party LAFs to provide tab overview dialog and tab hover preview.


The new addition to laf-widget layer provides the functionality of Ctrl Tab Firefox plugin. Once you install that plugin, pressing Ctrl+Tab opens three windows, one in the middle that shows a large thumbnail of a tab (starts from the current tab), and two side windows displaying small thumbnails of previous and next tabs. Each press on Tab key (while Ctrl is pressed) moves the thumbnails forward (cycling). Once Ctrl is released, the currently shown tab (in the middle thumbnail window) is selected.

For those of you who don't know, Swing already provides keyboard accelerators for switching the tabs. These are Ctrl+Page Up for moving forward and Ctrl+Page Down for moving backward. Two major disadvantages are:

  • The selection actually changes (which may trigger some application event handlers - may be undesirable if the user just wants to see the tab preview).
  • It only works in the current tab run.

The newly added (quite small ~10K) widget in laf-widget project (and subsequently in the new version of Substance) provides the Ctrl+Right Arrow and Ctrl+Left Arrow keyboard shortcuts that provide thumbnail paging of all tabs in the currently focused tabbed pane (Ctrl+Tab can not be taken since Tab event is already consumed by Swing for the focus transfer). Here is a screenshot to illustrate (click to see the full size):



Related Topics >>