List of usage examples for javax.swing JSeparator setSize
public void setSize(Dimension d)
From source file:org.openmicroscopy.shoola.util.ui.UIUtilities.java
/** * Create a separator to add to a toolbar. The separator needs to be * set when the layout of the toolbar is reset. * /*from ww w.j a v a2 s . c o m*/ * @param button The button to add to the toolBar. The height of the * separator depends of the insets of the button. * @param icon The icon to add to the button. The height of the * separator depends of the height of the icon. * @return See below. */ public static JSeparator toolBarSeparator(JButton button, Icon icon) { JSeparator separator = new JSeparator(SwingConstants.VERTICAL); if (button == null) return separator; Insets i = button.getInsets(); int h = 0; if (icon != null) h = icon.getIconHeight(); Dimension d = new Dimension(SEPARATOR_WIDTH, i.top + h + i.bottom); separator.setPreferredSize(d); separator.setSize(d); return separator; }