Tuesday January 16, 2007
Toolbar Configurations
If you define XML files that conform to the http://www.netbeans.org/dtds/toolbar.dtd, you can set up toolbar configurations and dynamically show or hide your toolbars. Everything I know about this I read in the FAQ: How do I hide and show toolbars the way the debugger does?. Handily, the IDE comes with two of its own toolbar configuration files, called Coding.xml and Debugging.xml, as you'll find when you expand the Toolbars folders within "<this layer in context>". For example, this is what Coding.xml looks like:
<!DOCTYPE Configuration PUBLIC "-//NetBeans IDE//DTD toolbar//EN"
"http://www.netbeans.org/dtds/toolbar.dtd">
<Configuration>
<Row>
<Toolbar name="File" />
<Toolbar name="Edit" />
<Toolbar name="Build" />
<Toolbar name="Debug" visible="false" />
<Toolbar name="Memory" visible="false" />
<Toolbar name="Versioning" visible="false" />
</Row>
</Configuration>
Notice that the Debug toolbar and the Memory toolbar are both set to not be visible. In Debugging.xml, both of these are visible.
So all you need to do, after registering the XML files in the module layer file as described in the FAQ referenced above (which you do not need to do for Coding.xml and Debugging.xml, because these are part of the distribution), is say: "Now I want to use Coding.xml" (or Debugging.xml, depending which one you want). And you do that by simply coding this line:
ToolbarPool.getDefault().setConfiguration("Coding");
You'd use that line of code whenever you want a certain toolbar configuration to be displayed, such as when you open a window component group, for example. Here's a very simple example -- a new toolbar where I can click a radiobutton to show or hide a configuration:

Jan 16 2007, 10:04:20 AM PST Permalink
Hi,
unfortunately the link to FAQ "How to hide and show ..." is gone.
best regards
Oliver
Posted by Oliver on November 19, 2009 at 02:02 AM PST #


