KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > buchuki > ensmer > input > event > semantic > FocusEvent


1 /*
2  * Copyright 2004 Dusty Phillips
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */

16
17 package com.buchuki.ensmer.input.event.semantic;
18
19 import java.util.EventObject JavaDoc;
20
21 /**
22  * Class to represent a focus change on some object. As an implementation note,
23  * java.awt.FocusChangeEvent would have sufficed except that it extended
24  * AWTEvent, which means the source had to be a component; in this case the
25  * source is most likely an ObjectInputManager
26  *
27  * @author Dusty Phillips [dusty@buchuki.com]
28  */

29 public class FocusEvent extends EventObject JavaDoc {
30
31     /**
32      * Creates a new instance of FocusEvent.
33      *
34      * @param source the object that issued the FocusEvent, usually the
35      * ObjectInputManager
36      * @param focusedObject the identifier of the object that actually got
37      * focused.
38      * @param focusGained true if the object gained focus, false if it lost
39      * focus in this event.
40      */

41     public FocusEvent(Object JavaDoc source, Long JavaDoc focusedObject, boolean focusGained) {
42         super(source);
43         this. focusedObject = focusedObject;
44         this.focusGained = focusGained;
45     }
46
47     /**
48      * Get the object that was influenced by this event
49      *
50      * @return the identifier of the object who's focus changed
51      */

52     public Long JavaDoc getFocusedObject() {
53         return this.focusedObject;
54     }
55     
56     /**
57      * Get whether the object gained or lost focus
58      *
59      * @return true if the object gained focus, false if it lost focus
60      */

61     public boolean gainedFocus() {
62         return focusGained;
63     }
64     /**
65      * THe identifier of the object who's focus changed in this event
66      */

67     private Long JavaDoc focusedObject;
68     
69     /**
70      * whether the object gained or lost focus
71      */

72     private boolean focusGained;
73 }
74
Popular Tags