KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > text > event > ClickEvent


1 package text.event;
2
3 import java.awt.event.MouseEvent JavaDoc;
4
5 public class ClickEvent
6 {
7    protected boolean consumed = false;
8
9    /** consumes (i.e. halt) the event */
10    public void consume()
11    {
12       consumed = true;
13    }
14
15    /** says wether or not this event has been consumed */
16    public boolean isConsumed()
17    {
18       return consumed;
19    }
20
21    public boolean isAcknowledged()
22    {
23       return ack;
24    }
25
26    public void acknowledge()
27    {
28       ack = true;
29    }
30
31    protected boolean ack;
32    protected String JavaDoc context;
33    protected String JavaDoc word;
34    protected MouseEvent JavaDoc event;
35
36    public MouseEvent JavaDoc getEvent()
37    {
38       return event;
39    }
40
41    public ClickEvent(String JavaDoc _word, String JavaDoc _context, MouseEvent JavaDoc _event)
42    {
43       context = _context;
44       word = _word;
45       event = _event;
46    }
47
48    /** returns the specific word/token that the user clicked on */
49    public String JavaDoc getClickedText()
50    {
51       return word;
52    }
53
54    /** returns the entire line of text that contains the clicked word */
55    public String JavaDoc getContext()
56    {
57       return context;
58    }
59 }
60
Popular Tags