private void layoutComponents() {
final JToolBar toolBar = new JToolBar();
toolBar.setFloatable(false);
// Change layout because BoxLayout glue doesn't work well under Linux
toolBar.setLayout(new GridBagLayout());
ActionMap actions = getActionMap();
final JButton previousButton = new JButton(actions.get(ActionType.SHOW_PREVIOUS));
final JButton nextButton = new JButton(actions.get(ActionType.SHOW_NEXT));
toolBar.add(previousButton);
toolBar.add(nextButton);
layoutToolBarButtons(toolBar, previousButton, nextButton);
toolBar.addPropertyChangeListener("componentOrientation",
new PropertyChangeListener () {
public void propertyChange(PropertyChangeEvent evt) {
layoutToolBarButtons(toolBar, previousButton, nextButton);
}
});
toolBar.add(new JLabel(),
new GridBagConstraints(2, 0, 1, 1, 1, 0, GridBagConstraints.CENTER,
GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0));
if (!OperatingSystem.isMacOSXLeopardOrSuperior()) {
toolBar.add(this.searchLabel,
new GridBagConstraints(3, 0, 1, 1, 0, 0, GridBagConstraints.CENTER,
GridBagConstraints.NONE, new Insets(0, 0, 0, 5), 0, 0));
}
toolBar.add(this.searchTextField,
new GridBagConstraints(4, 0, 1, 1, 0, 0, GridBagConstraints.CENTER,
GridBagConstraints.HORIZONTAL, new Insets(0, 0, 0, 0), 0, 0));
this.searchTextField.setMaximumSize(this.searchTextField.getPreferredSize());
// Ignore search button under Mac OS X 10.5 (it's included in the search field)
if (!OperatingSystem.isMacOSXLeopardOrSuperior()) {
toolBar.add(new JButton(actions.get(ActionType.SEARCH)),
new GridBagConstraints(5, 0, 1, 1, 0, 0, GridBagConstraints.CENTER,
GridBagConstraints.NONE, new Insets(0, 5, 0, 0), 0, 0));
}
// Remove focusable property on buttons
for (int i = 0, n = toolBar.getComponentCount(); i < n; i++) {