public void layoutContainer(Container target) {
		synchronized(target.getTreeLock()) {
			Dimension toolbarDim = preferredLayoutSize(target);
			Insets insets = target.getInsets();
			if(isHorizontal) {
				int left = insets.left;
				/*for (int i = 0; i < components.size(); i++) {
				  Component comp = (Component) components.get(i);
				  if (comp.isVisible()){
				    Dimension d = comp.getPreferredSize();
				    comp.setBounds(left, insets.top, d.width, toolbarDim.height - insets.top - insets.bottom);
				    left += d.width + gap;
				  }
				}*/
				if(target.getComponentOrientation().isLeftToRight()) {
					for(int i = 0; i < components.size(); i++) {
						left = layoutHorizComponent((Component) components.get(i), toolbarDim, insets, left);
					}
				} else {
					// Right to left
					Component firstComp = components.size() == 0 ? null : (Component) components.get(0);
					int endWith = 0;
					if(firstComp != null && firstComp instanceof ToolBarGripper) {
						left = layoutHorizComponent(firstComp, toolbarDim, insets, left);
						endWith = 1;
					}
					for(int i = components.size() - 1; i >= endWith; i--) {
						left = layoutHorizComponent((Component) components.get(i), toolbarDim, insets, left);
					}
				}
			} else { //vertical
				@SuppressWarnings("unused")
				int centerX = insets.left + (toolbarDim.width - insets.left - insets.right) / 2;
				int top = insets.top;
				for(int i = 0; i < components.size(); i++) {
					Component comp = (Component) components.get(i);
					if(comp.isVisible()) {
						Dimension d = comp.getPreferredSize();
						comp.setBounds(insets.left, top, toolbarDim.width - insets.left - insets.right, d.height);
						top += d.height + gap;
					}
				}
			}
		}
	}