Page 1 :
Event Handling, , , , , , , , , , T, , , , , , , , WindowFocusListener Interface., , SSS ee, Syllabus Topic : The Delegation Event Model , Event Sources, Event Listeners, , 3.1 The Delegation Event Model : Event, Sources, Event Listeners, , , , Q.3.1.1 Write note on Event Handling,, (Ret. Sec. 3.1) (Likely Ques), , — The delegation event model is based on the Event, Source and Event Listeners. We will see all the, concepts regarding delegation event model :, , , , , , , , @ Event, — Changing the state of an object is known as an event., , — It can be triggered by typing in a text field, selecting an, item from the menu etc., , - Events may also be triggered when timer expires,, hardware or software failure occurs, operation, , completes, counter is increased or decreased by a value, etc,, , — Event handling : The mechanism of respondin;, , — More often the event source is a button or ;, , , , The delegation Event Model : Event sources, Event listeners, Event classes : The Action Event class, the Item, Event class, the Key Event class, the Mouse Event class, the Text Event class, the Window Event class. Adapje,, Classes, Inner classes, Event listener interfaces : ActionListener Interface, ItemListener Interface, KeyListener, Interface, MouseListener Interface, MouseMotion Interface, TextListener Interface, WindowsListener Interface,, , , , , , , , , , , — Event handler : The code which gets executed jj, , response to an event is known as event handler,, , events is called as Event Handling., , — Event Source : It is an object which is responsib, , generating the event(s)., , component on which user can click but so, may also be swing component., , The work of the event source is to acce, get events from the user and invoke the, handling method., Event Listener : I is an object 4, and handles them with proper n, It can be considered as a, events from the source,, , The work of an event listen
Page 2 :
a, Adv. Jawa Pr amming (MSBTE-Sem 5-CompiT) 32, Syllabus Topic : Event Classes 4, L, 3.2 _ Event Classes a, — f e, eo = > 2 Se, javaawLevent package provices sumber of event eel, “gh a this action, classes to handle events., syllabus Topic : The Action Event Class 3. tong getWhen0) aid, a Returns the timestamp of when this event occurred., rent /, 3.2.1 The Action Ev Class 4. String paramString), , , , , 321 Enlist constructors and methods of, , , , , , , , , , een ae 3.2.2 The Component Event Class, (Ret. Sec. 32.1) (Likely Ques) :, Q322 Enlist constructors and methods of, — Action Event class is member of javaawLeveat Component Event class., package. (Ref. Sec. 32.2) (Likely ¢, , , , , , This is considered as a low level event which implies, that a component has been moved, changed size, or, changed visibility., , -— This respective event is transferred to every, ComponentListener oF ComponentAdapter object, which has been registered to receive these types of, events with the help of the component's, addComponentlistener method., , - The ActionEvent is generated when button is clicked or =, the list item is double clicked., , - This respective event is transferred to every, ‘ActionListener object that is registered to receive such, events using the component's addActionListener
Page 3 :
[] Adv. Java Programming (MSBTE-Sem 5-Comp/IT) _ 3-3, , , , is considered as a low level event which implies | 2, FocusEvent(Component Source, in, This is c, , tid, boo)..., that a container's contents have been changed since a temporary), component was added or removed., , 4 Constructs a FocusEvent object ang identig,, , - Container events are provided for notification. OF not the change is temporary, Whethe,, , = Constructors 2 oe Source, int ig Dooley, rar mponent i, 1, ContainerEvent(Component source, int id, porary, Compoi pposite), Component child) 5 4 Constructs a FocusEvent object with the spe :, ~ Specifia,, 4 Constructs a ContainerEvent object, temporary state and opposite Component, By, = Methods @ Methods, 1. Component getChild() 1. Component BetOppositeComponent(), Wt Returns the component that was affected by the event. | // Returns other Component involved in this focus, A change,, 2 Container getContainer(), # Returns the originator of the event. 2. booleanis Temporary(), 3. String paramString() 4 Identifies the focus change event as temporary op, rmanent,, Ts Returns a parameter string identifying this event. PS, , 3. String ParamString(), , 3.2.4 The Focus Event Class “Returns a parameter String identifying this event., , , , , 9.3.2.4 Enlist constructors and methods of FocusEvent, , Syllabus Topic : The item Event Class, class. (Ref. Sec. 3.2.4) (Likely Ques) ees, , 3.2.5 The Item Event Class, This is considered as a low level event which implies, that a Component has ained or lost the input focus., , , , , , , , , , Q.3.25 Enlist constructors and methods of ItemEvent, , , , This low-level event is generated by a Component, , , , , , , , Glass. (Ref. Sec. 3.2.5) (Likely Ques), (such as a TextField)., — A semantic event which indicates that an item was, ~ This respective event is transferred to every selected or deselected, FocusListener or FocusAdapter object which has been scrshh 3, “bt ic a : table, registered to receive these types of events with the help This high-level €vent is generated by an a i., = 5 ne ae, ofthe Components at dFocusL istener meth = object (such as a List) when an item is selecte, deselected by the user,, — (FocusAdapter objects implement the FocusListener Ae coer, = it 7 i fo, interface.) Each such listener Object gets this This respective ae canilst istered. to, : ‘ : rn, FocusEvent when this event is fired. TemListener object which has been ae he, Feceive these types of events with the help of #, * Constructors component's addItemListener method,, Was,, i) FocusEvent(Component source, int id) an | ~, , ea The object that implements the ItemListener interface, W Constructs a FocusEvent ‘object and identifies it a Bets this ItemEvent when this event is fired., , Venture, Tec-Noo Pablistions Where Author lame oovauac 4 GN
Page 5 :
Syllabus Topic : The Mouse Event Class, , 3.2.7 The Mouse Event Class, , , , , , Q.327 Enlist constructors and methods, MouseEvent class., , (Ref. Sec. 3.2.7), , of, , , , , , (Likely Ques), An event which indicates that a mouse action js, occurred in a component., , A mouse action is considered to occur in @ particular, component if and only if the mouse cursor is over the, , un-obscured part of the somponent’s bounds when the, action happens., , A mouse event type is enabled by adding the, appropriate mouse-based EventListener to the, component (MouseListener or MouseMotionListener), , * Constructors, , L MouseEvent(Component source, int id, long when,, Int modifiers, int x, int y, int clickCount, boolean, , , , , , , , Returns the Aumber oy, , f mouse, , ‘ Clicks, this event 7, , Ciate d With, Point 8etLocationc NScreen(), , Retums the absolute x y, , int RetModifiersk:x, ), , POSition of the ey n, ent, , , , , , , , , , , , i), “, , Such as "Shift", or “Ctr shift", , 6. Point RetPoint(), , 4 Returns the %Y Position of the ev, , eNt relative, Source Component., , 7. int getX(), , 4 Returns the horizontal x Position of the event:, , to the source component, 8. int getXOnScreen(), 4 Returns the absolute horizontal x position off, 9 int RetY(), 4 Returns the vertical y position of the, the source component., , Syllabus Topic : The Text Event, , 3.2.8 The Text Event Class, , , , — A semantic event ee !, has been changed. This