1 17 package org.columba.core.gui.toolbar; 18 19 import java.awt.Insets ; 20 21 import javax.swing.Action ; 22 import javax.swing.Icon ; 23 import javax.swing.JButton ; 24 25 30 @SuppressWarnings ("serial") 31 public class ToolBarButton extends JButton { 32 33 public ToolBarButton(String text, Icon icon) { 34 super(text, icon); 35 36 initButton(); 37 } 38 39 public ToolBarButton() { 40 super(); 41 initButton(); 42 } 43 44 45 public ToolBarButton(Action action) { 46 super(action); 47 48 initButton(); 49 } 50 51 private void initButton() { 52 setRolloverEnabled(true); 53 setRequestFocusEnabled(false); 54 setMargin(new Insets (1, 1, 1, 1)); 55 putClientProperty("JToolBar.isRollover", Boolean.TRUE); 56 } 57 58 public boolean isFocusTraversable() { 59 return isRequestFocusEnabled(); 60 } 61 62 65 public void updateUI() { 66 super.updateUI(); 67 68 setRolloverEnabled(true); 69 putClientProperty("JToolBar.isRollover", Boolean.TRUE); 70 } 71 } 72 | Popular Tags |