01: ////////////////////////////////////////////////////////////////////////////////
02: // Test case file for checkstyle.
03: // Created: 2001
04: ////////////////////////////////////////////////////////////////////////////////
05: package com.puppycrawl.tools.checkstyle;
06:
07: import java.awt.event.MouseEvent;
08: import java.awt.event.MouseAdapter;
09: import javax.swing.JButton;
10:
11: /**
12: * Tests for anonymous inner types
13: * @author Lars Kühne
14: **/
15: public class InputScopeAnonInner {
16: /**
17: button.
18: */
19: private JButton mButton = new JButton();
20:
21: /**
22: anon inner in member variable initialization.
23: */
24: private Runnable mRunnable = new Runnable() {
25: public void run() // should not have to be documented, class is anon.
26: {
27: System.out.println("running");
28: }
29: };
30:
31: /**
32: anon inner in constructor.
33: */
34: InputScopeAnonInner() {
35: mButton.addMouseListener(new MouseAdapter() {
36: public void mouseClicked(MouseEvent aEv) {
37: System.out.println("click");
38: }
39: });
40: }
41:
42: /**
43: anon inner in method
44: */
45: public void addInputAnonInner() {
46: mButton.addMouseListener(new MouseAdapter() {
47: public void mouseClicked(MouseEvent aEv) {
48: System.out.println("click");
49: }
50: });
51: }
52: }
|