1 51 package org.apache.fop.viewer; 52 53 59 60 61 import javax.swing.*; 62 import java.beans.PropertyChangeListener ; 63 64 public class IconToolBar extends JToolBar { 65 66 public JButton add(Action a) { 67 String name = (String )a.getValue(Action.NAME); 68 Icon icon = (Icon)a.getValue(Action.SMALL_ICON); 69 return add(a, name, icon); 70 } 71 72 public JButton add(Action a, String name, Icon icon) { 73 JButton b = new JButton(icon); 74 b.setToolTipText(name); 75 b.setEnabled(a.isEnabled()); 76 b.addActionListener(a); 77 add(b); 78 PropertyChangeListener actionPropertyChangeListener = 79 createActionChangeListener(b); 80 a.addPropertyChangeListener(actionPropertyChangeListener); 81 return b; 82 } 83 84 } 85 86 87 | Popular Tags |