KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > hero > client > grapheditor > WFToolBar


1 package hero.client.grapheditor;
2
3 /**
4  * WFToolBar.java
5  *
6  *
7  * Created: Fri Aug 09 16:18:15 2002
8  *
9  * @version 1.0
10  */

11
12 import java.awt.Insets JavaDoc;
13 import java.awt.event.ActionEvent JavaDoc;
14 import java.awt.event.ActionListener JavaDoc;
15 import java.awt.Color JavaDoc;
16
17 import javax.swing.ImageIcon JavaDoc;
18 import javax.swing.JButton JavaDoc;
19
20
21 public class WFToolBar extends javax.swing.JToolBar JavaDoc {
22
23 static java.util.ResourceBundle JavaDoc resource = java.util.ResourceBundle.getBundle("resources.Traduction")/*#BundleType=List*/;
24
25     public WFToolBar (final Frame frame,final WFManager manager){
26     
27     super.setFloatable(true);
28     boolean buttonState = manager.getPersistence().hasPermission();
29     JButton JavaDoc jb;
30     this.setMargin(new Insets JavaDoc(0,5,0,0));
31     this.putClientProperty("JToolBar.isRollover", Boolean.TRUE);
32     this.setBackground(new Color JavaDoc(177,177,251));
33
34
35     ClassLoader JavaDoc cl = frame.getClass().getClassLoader();
36     
37     // New
38
jb = new JButton JavaDoc(new ImageIcon JavaDoc(cl.getResource("images/new.png")));
39     jb.setToolTipText(resource.getString("wftoolbar.newproj"));
40     jb.setBackground(new Color JavaDoc(177,177,251));
41     jb.setMargin(new Insets JavaDoc(0,0,0,0));
42     jb.setText(null);
43     jb.addActionListener (new ActionListener JavaDoc () {
44         public void actionPerformed (ActionEvent JavaDoc e) {
45             manager.newProject();
46         }
47         });
48     super.add(jb);
49
50     // Open
51
jb = new JButton JavaDoc(new ImageIcon JavaDoc(cl.getResource("images/open.png")));
52     jb.setToolTipText(resource.getString("wftoolbar.openproj"));
53     jb.setBackground(new Color JavaDoc(177,177,251));
54     jb.setMargin(new Insets JavaDoc(0,0,0,0));
55     jb.setText(null);
56     jb.addActionListener (new ActionListener JavaDoc () {
57         public void actionPerformed (ActionEvent JavaDoc e) {
58             manager.openProject();
59         }
60         });
61     super.add(jb);
62
63     super.addSeparator();
64     // Copy
65
jb = new JButton JavaDoc(new ImageIcon JavaDoc(cl.getResource("images/Copy.gif")));
66     jb.setBackground(new Color JavaDoc(177,177,251));
67     jb.setToolTipText(resource.getString("wftoolbar.copy"));
68     jb.setMargin(new Insets JavaDoc(0,0,0,0));
69     jb.setText(null);
70     jb.setEnabled(buttonState);
71     jb.addActionListener (new ActionListener JavaDoc () {
72         public void actionPerformed (ActionEvent JavaDoc e) {
73             manager.copySelection();
74         }
75         });
76     super.add(jb);
77
78     // Paste
79
jb = new JButton JavaDoc(new ImageIcon JavaDoc(cl.getResource("images/Paste.gif")));
80     jb.setToolTipText(resource.getString("wftoolbar.paste"));
81     jb.setBackground(new Color JavaDoc(177,177,251));
82     jb.setMargin(new Insets JavaDoc(0,0,0,0));
83     jb.setText(null);
84     jb.setEnabled(buttonState);
85     jb.addActionListener (new ActionListener JavaDoc () {
86         public void actionPerformed (ActionEvent JavaDoc e) {
87             manager.pasteSelection();
88         }
89         });
90     super.add(jb);
91
92     // Delete
93
jb = new JButton JavaDoc(new ImageIcon JavaDoc(cl.getResource("images/Delete.gif")));
94     jb.setToolTipText(resource.getString("wftoolbar.delete"));
95     jb.setBackground(new Color JavaDoc(177,177,251));
96     jb.setMargin(new Insets JavaDoc(0,0,0,0));
97     jb.setText(null);
98     jb.setEnabled(buttonState);
99     jb.addActionListener (new ActionListener JavaDoc () {
100         public void actionPerformed (ActionEvent JavaDoc e) {
101             manager.deleteSelection();
102         }
103         });
104     super.add(jb);
105
106     super.addSeparator();
107
108
109     super.addSeparator();
110     
111     jb = new JButton JavaDoc(new ImageIcon JavaDoc(cl.getResource("images/Zoom100.gif"))); // Zoom 100%
112
jb.setToolTipText(resource.getString("wftoolbar.zoom100"));
113     jb.setBackground(new Color JavaDoc(177,177,251));
114     jb.setMargin(new Insets JavaDoc(0,0,0,0));
115     jb.addActionListener (new ActionListener JavaDoc () {
116         public void actionPerformed (ActionEvent JavaDoc e) {
117             manager.zoom(100);
118         }
119         });
120     super.add(jb);
121     
122     jb = new JButton JavaDoc(new ImageIcon JavaDoc(cl.getResource("images/ZoomIn.gif"))); // Zoom In
123
jb.setToolTipText(resource.getString("wftoolbar.zoomin"));
124     jb.setBackground(new Color JavaDoc(177,177,251));
125     jb.setMargin(new Insets JavaDoc(0,0,0,0));
126     jb.addActionListener (new ActionListener JavaDoc () {
127         public void actionPerformed (ActionEvent JavaDoc e) {
128             manager.zoomIn();
129         }
130         });
131     super.add(jb);
132     
133     jb = new JButton JavaDoc(new ImageIcon JavaDoc(cl.getResource("images/ZoomOut.gif"))); // Zoom Out
134
jb.setToolTipText(resource.getString("wftoolbar.zoomout"));
135     jb.setBackground(new Color JavaDoc(177,177,251));
136     jb.setMargin(new Insets JavaDoc(0,0,0,0));
137     jb.addActionListener (new ActionListener JavaDoc () {
138         public void actionPerformed (ActionEvent JavaDoc e) {
139             manager.zoomOut();
140         }
141         });
142     super.add(jb);
143
144     super.addSeparator();
145
146     // Layout
147
jb = new JButton JavaDoc(new ImageIcon JavaDoc(cl.getResource("images/Arrange.gif")));
148     jb.setToolTipText(resource.getString("wftoolbar.circlay"));
149     jb.setBackground(new Color JavaDoc(177,177,251));
150     jb.setMargin(new Insets JavaDoc(0,0,0,0));
151     jb.setText(null);
152     jb.addActionListener (new ActionListener JavaDoc () {
153         public void actionPerformed (ActionEvent JavaDoc e) {
154             manager.setLayout1();
155         }
156         });
157     super.add(jb);
158     
159     jb = new JButton JavaDoc(new ImageIcon JavaDoc(cl.getResource("images/Layout.gif")));
160     jb.setToolTipText(resource.getString("wftoolbar.expand"));
161     jb.setBackground(new Color JavaDoc(177,177,251));
162     jb.setMargin(new Insets JavaDoc(0,0,0,0));
163     jb.setText(null);
164     jb.addActionListener (new ActionListener JavaDoc () {
165         public void actionPerformed (ActionEvent JavaDoc e) {
166             manager.setLayout2();
167         }
168         });
169     super.add(jb);
170
171     
172     }
173 }
174
Popular Tags