Search code examples
javanetbeans-platform

Right aligning some components of the toolbar in netbeans platform application


I need to right align some icons in the toolbar. So that, I have put below piece of code in the layer.xml.

   <folder name="Toolbars">
    <file name="ToolbarConfigurations.xml" url="ToolbarConfigurations.xml">
        <attr name="position" intvalue="675"/>
    </file>         
   </folder>

And then, I created a ToolbarConfigurations.xml and following is its content.

<?xml version="1.0"?>
<!DOCTYPE Configuration PUBLIC "-//NetBeans IDE//DTD toolbar//EN"
"http://www.netbeans.org/dtds/toolbar.dtd">
<Configuration> 
  <Row>
    <Toolbar name="Extras" align="right" dragable="false"/>  
  </Row>
</Configuration>

However, it doesn't align the components right and following is what I have refereed so far, Anchialas' Java Blog

Really appreciate your help......


Solution

  • Found a solution for this, i.e putting below 2 lines to the layer.xml resolved the issue.

    <folder name="Toolbars">
        <file name="ToolbarConfigurations.xml" url="ToolbarConfigurations.xml">
            <attr name="position" intvalue="675"/>
        </file>  
        <file name="Standard.xml_hidden"/>
        <file name="Debugging.xml_hidden"/>
    </folder>
    

    When "Standard" is invoked and Standard is not available, it will actually enable the first available toolbar configuration.

    Also, I tried setConfiguration("ToolbarConfigurations") and it worked fine.

    ToolbarPool.getDefault().setConfiguration("ToolbarConfigurations");