* depending on toolbar orientation.
*/
private void layoutToolBarButtons(JToolBar toolBar,
JButton previousButton,
JButton nextButton) {
ComponentOrientation orientation = toolBar.getComponentOrientation();
GridBagLayout layout = (GridBagLayout)toolBar.getLayout();
GridBagConstraints firstButtonConstraints = new GridBagConstraints(
0, 0, 1, 1, 0, 0, GridBagConstraints.CENTER,
GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0);
GridBagConstraints secondButtonContraints = new GridBagConstraints(
1, 0, 1, 1, 0, 0, GridBagConstraints.CENTER,
GridBagConstraints.NONE, new Insets(0, 0, 0, 5), 0, 0);
layout.setConstraints(orientation.isLeftToRight() ? previousButton : nextButton,
firstButtonConstraints);
layout.setConstraints(orientation.isLeftToRight() ? nextButton : previousButton,
secondButtonContraints);
// Use segmented buttons under Mac OS X 10.5
if (OperatingSystem.isMacOSXLeopardOrSuperior()) {
previousButton.putClientProperty("JButton.buttonType", "segmentedTextured");
previousButton.putClientProperty("JButton.segmentPosition", "first");