1. Поставь setRollover(false), и увидишь, что поведение меняется. 2. Сделай так:
| Код | final int border = 5; JToolBar toolBar = new JToolBar(); toolBar.setRollover(true); JButton button1 = new JButton("Button 1"); button1.setBorder(BorderFactory.createEmptyBorder(border, border, border, border)); button1.setFocusable(false); toolBar.add(button1); JButton button2 = new JButton("Button 2"); button2.setBorder(BorderFactory.createEmptyBorder(border, border, border, border)); button2.setFocusable(false); toolBar.add(button2); |
|