{"id":577,"date":"2012-10-09T08:32:10","date_gmt":"2012-10-09T06:32:10","guid":{"rendered":"http:\/\/www.pellissier.co.za\/hermien\/?p=577"},"modified":"2012-10-09T08:32:10","modified_gmt":"2012-10-09T06:32:10","slug":"adding-a-separator-to-a-toolbar","status":"publish","type":"post","link":"https:\/\/www.pellissier.co.za\/hermien\/?p=577","title":{"rendered":"Quick Tip: Adding a Separator to a Toolbar"},"content":{"rendered":"<p>Sometimes it is useful to be able to visually separate groups of buttons on the main application toolbar. However, the NetBeans Platform doesn&#8217;t add separators to the toolbar by default as it is able to for the menubar. When I recently saw the question being posed again, I decided that it is time to find a way to accomplish this. And the key was in fact the <a href=\"http:\/\/platform.netbeans.org\/tutorials\/nbm-google.html\">NetBeans IDE 7.2 Plugin Quick Start<\/a> tutorial. That tutorial describes how you can add other components besides buttons to the toolbar.<\/p>\n<p>I followed the tutorial, but I didn&#8217;t create a panel. Instead I implemented the getToolbarPresenter() as follows:<\/p>\n<p>[java]@Override<br \/>\npublic Component getToolbarPresenter() {<br \/>\n    JSeparator separator = new JSeparator();<br \/>\n    separator.setOrientation(JSeparator.VERTICAL);<br \/>\n    return separator;<br \/>\n}[\/java]<\/p>\n<p>That is it. Now I have a separator between two of the buttons on the toolbar.<\/p>\n<figure id=\"attachment_578\" aria-describedby=\"caption-attachment-578\" style=\"width: 144px\" class=\"wp-caption aligncenter\"><a href=\"http:\/\/www.pellissier.co.za\/h\/wp-content\/uploads\/sites\/2\/2012\/10\/separator.png\"><img loading=\"lazy\" src=\"http:\/\/www.pellissier.co.za\/h\/wp-content\/uploads\/sites\/2\/2012\/10\/separator.png\" alt=\"Separator on the toolbar\" title=\"Separator on the toolbar\" width=\"154\" height=\"60\" class=\"size-full wp-image-578\" \/><\/a><figcaption id=\"caption-attachment-578\" class=\"wp-caption-text\">Separator on the toolbar<\/figcaption><\/figure>\n","protected":false},"excerpt":{"rendered":"<p>Sometimes it is useful to be able to visually separate groups of buttons on the main application toolbar. However, the NetBeans Platform doesn&#8217;t add separators to the toolbar by default as it is able to for the menubar. When I recently saw the question being posed again, I decided that it is time to find &#8230; <a title=\"Quick Tip: Adding a Separator to a Toolbar\" class=\"read-more\" href=\"https:\/\/www.pellissier.co.za\/hermien\/?p=577\" aria-label=\"More on Quick Tip: Adding a Separator to a Toolbar\">Read more<\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"spay_email":"","jetpack_publicize_message":"","jetpack_is_tweetstorm":false},"categories":[3,5],"tags":[],"jetpack_featured_media_url":"","jetpack_publicize_connections":[],"jetpack_sharing_enabled":true,"jetpack_shortlink":"https:\/\/wp.me\/p1v8WL-9j","_links":{"self":[{"href":"https:\/\/www.pellissier.co.za\/hermien\/index.php?rest_route=\/wp\/v2\/posts\/577"}],"collection":[{"href":"https:\/\/www.pellissier.co.za\/hermien\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.pellissier.co.za\/hermien\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.pellissier.co.za\/hermien\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.pellissier.co.za\/hermien\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=577"}],"version-history":[{"count":0,"href":"https:\/\/www.pellissier.co.za\/hermien\/index.php?rest_route=\/wp\/v2\/posts\/577\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.pellissier.co.za\/hermien\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=577"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.pellissier.co.za\/hermien\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=577"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.pellissier.co.za\/hermien\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=577"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}