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