List of usage examples for javax.swing JToolBar getComponentCount
public int getComponentCount()
From source file:uk.nhs.cfh.dsp.srth.desktop.uiframework.utils.ActionComponentManager.java
/** * Check and add toolbar button.//from w ww. jav a 2s .com * * @param toolBar the tool bar * @param button the button * @param toolBarIndex the tool bar index */ private synchronized void checkAndAddToolbarButton(JToolBar toolBar, JideButton button, int toolBarIndex) { // check component count of toolBar before adding button at toolBarIndex int componentCount = toolBar.getComponentCount(); if (componentCount > toolBarIndex) { // add horizontal space if component count > 0 if (componentCount > 0) { toolBar.add(Box.createHorizontalStrut(5)); } toolBar.add(button, toolBarIndex); } else { toolBar.add(button, componentCount); } }