1
2
3
4
5
6
7 package com.vikash.firsttool.Diagram.DiagramBars;
8 import com.vikash.firsttool.Diagram.*;
9 import com.vikash.firsttool.UI.*;
10
11 import java.net.URL;
12 import java.awt.event.*;
13 import java.awt.*;
14 import javax.swing.*;
15 import javax.swing.Action;
16 import javax.swing.JToolBar;
17
18 /***
19 *
20 * @author studajb
21 */
22 public class SWOTBar extends JToolBar {
23
24 EditorPanel panel;
25 ButtonGroup group;
26 /*** Creates a new instance of SwotIconPanel */
27 public SWOTBar(final EditorPanel panel) {
28
29 this.panel=panel;
30 group=new ButtonGroup();
31 CreateIcon("Select","Select","Select");
32 CreateIcon("Stakeholder","vertex","Stakeholder");
33 CreateIcon("Uniassociation","uniassociation","<html><p align=\"center\">"+"UniAssociation"+"<br>"+"Stakeholder ----> Enterprise *"+"<br>"+"Asset ----> Enterprise *"+"</p></html>");
34 CreateIcon("EnterpriseAsset","vertex","EnterpriseAsset");
35 CreateIcon("EnterpriseStrength","vertex","EnterpriseStrength");
36 CreateIcon("EnterpriseWeakness","vertex","EnterpriseWeakness");
37 CreateIcon("EnterpriseOpportunity","vertex","EnterpriseOpportunity");
38 CreateIcon("EnterpriseThreat","vertex","EnterpriseThreat");
39
40
41
42
43 }
44 private void CreateIcon(String name,String type,String tooltip){
45
46 URL iconurl=getClass().getClassLoader().getResource("com/vikash/firsttool/resources/"+name+".gif");
47 Action iconaction= new DrawAction(tooltip,new ImageIcon(iconurl),name,panel,type);
48 JToggleButton button = new JToggleButton(iconaction);
49 button.setPreferredSize(new Dimension(30,30));
50 button.setMaximumSize(new Dimension(30,30));
51 group.add(button);
52 add(button);
53 }
54 }