001: package hero.client.grapheditor;
002:
003: /**
004: * WFToolBar.java
005: *
006: *
007: * Created: Fri Aug 09 16:18:15 2002
008: *
009: * @version 1.0
010: */
011:
012: import java.awt.Insets;
013: import java.awt.event.ActionEvent;
014: import java.awt.event.ActionListener;
015: import java.awt.Color;
016:
017: import javax.swing.ImageIcon;
018: import javax.swing.JButton;
019:
020: public class WFToolBar extends javax.swing.JToolBar {
021:
022: static java.util.ResourceBundle resource = java.util.ResourceBundle
023: .getBundle("resources.Traduction")/*#BundleType=List*/;
024:
025: public WFToolBar(final Frame frame, final WFManager manager) {
026:
027: super .setFloatable(true);
028: boolean buttonState = manager.getPersistence().hasPermission();
029: JButton jb;
030: this .setMargin(new Insets(0, 5, 0, 0));
031: this .putClientProperty("JToolBar.isRollover", Boolean.TRUE);
032: this .setBackground(new Color(177, 177, 251));
033:
034: ClassLoader cl = frame.getClass().getClassLoader();
035:
036: // New
037: jb = new JButton(
038: new ImageIcon(cl.getResource("images/new.png")));
039: jb.setToolTipText(resource.getString("wftoolbar.newproj"));
040: jb.setBackground(new Color(177, 177, 251));
041: jb.setMargin(new Insets(0, 0, 0, 0));
042: jb.setText(null);
043: jb.addActionListener(new ActionListener() {
044: public void actionPerformed(ActionEvent e) {
045: manager.newProject();
046: }
047: });
048: super .add(jb);
049:
050: // Open
051: jb = new JButton(new ImageIcon(cl
052: .getResource("images/open.png")));
053: jb.setToolTipText(resource.getString("wftoolbar.openproj"));
054: jb.setBackground(new Color(177, 177, 251));
055: jb.setMargin(new Insets(0, 0, 0, 0));
056: jb.setText(null);
057: jb.addActionListener(new ActionListener() {
058: public void actionPerformed(ActionEvent e) {
059: manager.openProject();
060: }
061: });
062: super .add(jb);
063:
064: super .addSeparator();
065: // Copy
066: jb = new JButton(new ImageIcon(cl
067: .getResource("images/Copy.gif")));
068: jb.setBackground(new Color(177, 177, 251));
069: jb.setToolTipText(resource.getString("wftoolbar.copy"));
070: jb.setMargin(new Insets(0, 0, 0, 0));
071: jb.setText(null);
072: jb.setEnabled(buttonState);
073: jb.addActionListener(new ActionListener() {
074: public void actionPerformed(ActionEvent e) {
075: manager.copySelection();
076: }
077: });
078: super .add(jb);
079:
080: // Paste
081: jb = new JButton(new ImageIcon(cl
082: .getResource("images/Paste.gif")));
083: jb.setToolTipText(resource.getString("wftoolbar.paste"));
084: jb.setBackground(new Color(177, 177, 251));
085: jb.setMargin(new Insets(0, 0, 0, 0));
086: jb.setText(null);
087: jb.setEnabled(buttonState);
088: jb.addActionListener(new ActionListener() {
089: public void actionPerformed(ActionEvent e) {
090: manager.pasteSelection();
091: }
092: });
093: super .add(jb);
094:
095: // Delete
096: jb = new JButton(new ImageIcon(cl
097: .getResource("images/Delete.gif")));
098: jb.setToolTipText(resource.getString("wftoolbar.delete"));
099: jb.setBackground(new Color(177, 177, 251));
100: jb.setMargin(new Insets(0, 0, 0, 0));
101: jb.setText(null);
102: jb.setEnabled(buttonState);
103: jb.addActionListener(new ActionListener() {
104: public void actionPerformed(ActionEvent e) {
105: manager.deleteSelection();
106: }
107: });
108: super .add(jb);
109:
110: super .addSeparator();
111:
112: super .addSeparator();
113:
114: jb = new JButton(new ImageIcon(cl
115: .getResource("images/Zoom100.gif"))); // Zoom 100%
116: jb.setToolTipText(resource.getString("wftoolbar.zoom100"));
117: jb.setBackground(new Color(177, 177, 251));
118: jb.setMargin(new Insets(0, 0, 0, 0));
119: jb.addActionListener(new ActionListener() {
120: public void actionPerformed(ActionEvent e) {
121: manager.zoom(100);
122: }
123: });
124: super .add(jb);
125:
126: jb = new JButton(new ImageIcon(cl
127: .getResource("images/ZoomIn.gif"))); // Zoom In
128: jb.setToolTipText(resource.getString("wftoolbar.zoomin"));
129: jb.setBackground(new Color(177, 177, 251));
130: jb.setMargin(new Insets(0, 0, 0, 0));
131: jb.addActionListener(new ActionListener() {
132: public void actionPerformed(ActionEvent e) {
133: manager.zoomIn();
134: }
135: });
136: super .add(jb);
137:
138: jb = new JButton(new ImageIcon(cl
139: .getResource("images/ZoomOut.gif"))); // Zoom Out
140: jb.setToolTipText(resource.getString("wftoolbar.zoomout"));
141: jb.setBackground(new Color(177, 177, 251));
142: jb.setMargin(new Insets(0, 0, 0, 0));
143: jb.addActionListener(new ActionListener() {
144: public void actionPerformed(ActionEvent e) {
145: manager.zoomOut();
146: }
147: });
148: super .add(jb);
149:
150: super .addSeparator();
151:
152: // Layout
153: jb = new JButton(new ImageIcon(cl
154: .getResource("images/Arrange.gif")));
155: jb.setToolTipText(resource.getString("wftoolbar.circlay"));
156: jb.setBackground(new Color(177, 177, 251));
157: jb.setMargin(new Insets(0, 0, 0, 0));
158: jb.setText(null);
159: jb.addActionListener(new ActionListener() {
160: public void actionPerformed(ActionEvent e) {
161: manager.setLayout1();
162: }
163: });
164: super .add(jb);
165:
166: jb = new JButton(new ImageIcon(cl
167: .getResource("images/Layout.gif")));
168: jb.setToolTipText(resource.getString("wftoolbar.expand"));
169: jb.setBackground(new Color(177, 177, 251));
170: jb.setMargin(new Insets(0, 0, 0, 0));
171: jb.setText(null);
172: jb.addActionListener(new ActionListener() {
173: public void actionPerformed(ActionEvent e) {
174: manager.setLayout2();
175: }
176: });
177: super.add(jb);
178:
179: }
180: }
|