blob: 8704aec91479f32b070d35f0b99b406d63c65ce6 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
|
package org.apache.fop.viewer;
/*
originally contributed by
Juergen Verwohlt: Juergen.Verwohlt@jCatalog.com,
Rainer Steinkuhle: Rainer.Steinkuhle@jCatalog.com,
Stanislav Gorkhover: Stanislav.Gorkhover@jCatalog.com
*/
import javax.swing.*;
import java.beans.PropertyChangeListener;
public class IconToolBar extends JToolBar {
public JButton add(Action a) {
String name = (String) a.getValue(Action.NAME);
Icon icon = (Icon) a.getValue(Action.SMALL_ICON);
return add(a, name, icon);
}
public JButton add(Action a, String name, Icon icon) {
JButton b = new JButton(icon);
b.setToolTipText(name);
b.setEnabled(a.isEnabled());
b.addActionListener(a);
add(b);
PropertyChangeListener actionPropertyChangeListener =
createActionChangeListener(b);
a.addPropertyChangeListener(actionPropertyChangeListener);
return b;
}
}
|