1+ package painttools .tools ;
2+
3+ import java .awt .event .ActionEvent ;
4+ import java .awt .event .ActionListener ;
5+ import java .awt .event .MouseEvent ;
6+
7+ import javax .swing .JButton ;
8+
9+ import ui .PaintPanel ;
10+ import actions .AddLazyJavaMethodComponentAction ;
11+
12+ public class AddMethodTool extends PaintTool {
13+
14+ private JButton button ;
15+
16+ public AddMethodTool (PaintPanel panel ) {
17+ button = new JButton ("Add Method" );
18+
19+ AddLazyJavaMethodComponentAction action = new AddLazyJavaMethodComponentAction (panel );
20+
21+ button .addActionListener (new ActionListener () {
22+ @ Override
23+ public void actionPerformed (ActionEvent e ) {
24+
25+ if (action .canPerformAction ()) {
26+ action .performAction ();
27+ }
28+
29+ }
30+ });
31+ }
32+
33+
34+ @ Override
35+ public void start (PaintPanel panel ) {
36+ }
37+
38+ @ Override
39+ public JButton getButton () {
40+ return button ;
41+ }
42+
43+ @ Override
44+ public void reset () {
45+
46+ }
47+
48+ @ Override
49+ public void mouseClicked (MouseEvent e ) {
50+ // TODO Auto-generated method stub
51+
52+ }
53+
54+ @ Override
55+ public void mouseEntered (MouseEvent e ) {
56+ // TODO Auto-generated method stub
57+
58+ }
59+
60+ @ Override
61+ public void mouseExited (MouseEvent e ) {
62+ // TODO Auto-generated method stub
63+
64+ }
65+
66+ @ Override
67+ public void mousePressed (MouseEvent e ) {
68+ // TODO Auto-generated method stub
69+
70+ }
71+
72+ @ Override
73+ public void mouseReleased (MouseEvent e ) {
74+ // TODO Auto-generated method stub
75+
76+ }
77+
78+ @ Override
79+ public void mouseDragged (MouseEvent e ) {
80+ // TODO Auto-generated method stub
81+
82+ }
83+
84+ @ Override
85+ public void mouseMoved (MouseEvent e ) {
86+ // TODO Auto-generated method stub
87+
88+ }
89+
90+
91+ }
0 commit comments