Programmatically Setting Multirow Tabs on the NetBeans Platform

The question of the day comes from the development team working on CAVER, which is a tool for the analysis and visualization of tunnels and channels in protein structures.

I would like to keep the tabs and get rid of the "Scroll Documents Left", "Scroll Documents Right" and the "Show Opened Documents list" buttons. Is there a way to do that?  

The question is asked today right at the end of the comments on "Farewell to Space Consuming Weird Tabs". The assumption one would have is to solve the problem above one would be forced to implement or extend a TabDisplayer or TabDisplayerUI class.

However, as luck would have it, a year or two ago Toni Epple and Stan Aubrecht created and integrated into the NetBeans sources an alternative NetBeans Window System implementation based on the standard Java Swing tab classes. Their implementation allows for the support of multirow tabs, which was a frequently requested feature in NetBeans IDE. An interesting "feature" of this implementation is that it does not have any of  the "Scroll Documents Left", "Scroll Documents Right" and the "Show Opened Documents list" buttons.

Below, you see the standard NetBeans Window System, with the buttons that the CAVER team don't want clearly visible, i.e., the 4 buttons to the right of the two tabs: 

Now, here is the same application, minus the buttons that we'd like to have removed:

The question is how to get to the above state at startup of the application. Though the user can go to the Options window and specify that multirow tabs should be supported, we'd rather have that set at startup automatically, so that the buttons we don't want are immediately absent.

The solution to this is very simple, but has one down side. Here's all you need to do, i.e., either use the @OnStart annotation or a ModuleInstall class (the latter must be registered in the manifest, which is one reason why @OnStart is nicer):

import org.openide.modules.OnStart;

public class Installer implements Runnable {

    public void run() {
        WinSysPrefs.HANDLER.putBoolean(WinSysPrefs.DOCUMENT_TABS_MULTIROW, true);
        WinSysPrefs.HANDLER.put(WinSysPrefs.DOCUMENT_TABS_PLACEMENT, "3");


The second statement above is only needed if you'd like to have the tabs at the bottom of the main window, at startup, rather than where they are by default, at the top.

The only downside to this solution is the import statement "". That import statement assumes you have an implementation dependency on the "Core - Windows" module. Ideally, the above settings would be publicly available, rather than private within the module. Since these settings are quite new, it's probably safe that they're internal for the moment, but making them public would avoid the implementation dependency, the only downside to this cool solution.

Agree/disagree with the need for these settings to be public? Vote and share your thought/s here:

Hope it helps, CAVER team! 


Post a Comment:
  • HTML Syntax: NOT allowed

Geertjan Wielenga (@geertjanw) is a Principal Product Manager in the Oracle Developer Tools group living & working in Amsterdam. He is a Java technology enthusiast, evangelist, trainer, speaker, and writer. He blogs here daily.

The focus of this blog is mostly on NetBeans (a development tool primarily for Java programmers), with an occasional reference to NetBeans, and sometimes diverging to topics relating to NetBeans. And then there are days when NetBeans is mentioned, just for a change.


« April 2015