0% found this document useful (0 votes)
19 views30 pages

Ajp 3

Uploaded by

matetisantosh37
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
19 views30 pages

Ajp 3

Uploaded by

matetisantosh37
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 30

Remove Watermark Wondershare

PDFelement

Subject:- AJP Code:- 22517


Course Code:- CO/CM/CW/IF-5I Semester:- Fifth

Prof. Vishal Chavare

https://www.gunwantmankar.com
/ 1
Remove Watermark Wondershare
PDFelement

https://www.gunwantmankar.com
/ 2
Wondershare
Online Exam pattern are as follows:Remove Watermark PDFelement

Total questions are: 42 Time:- 90 Minutes


Detail online exam pattern are as follows with chapter wise questions
Distribution of Marks
Unit
Unit Title R U A Total
No
Level Level Level Marks
Abstract Windowing Tool
1 2 4 6 12
Kit (AWT)
2 Swing 2 2 6 10
3 Event Handling 2 2 8 12
4 Networking Basics 2 4 4 10
Interacting with
5 2 4 6 12
Database
6 Servlets 4 4 6 14
Total 14 20 36 70

• (R) Remember Level (Basic Level):-Total Question:-14 (1 mark each)


These are very simple questions and it will not take more than 15 to 20 minutes to solve.

• (U) Understand Level:- Total Question:-10 (2 marks each).


These are understand level questions, difficulty level little increases.

• (A) Apply Level:- Total Question:-18 (2 marks each).


These are apply level questions means you have to apply your knowledge to solve these
questions and again difficulty level is increases.
https://www.gunwantmankar.com
/ 3
Remove Watermark Wondershare
PDFelement

Distribution of Marks
Unit
Unit Title R U A
No
Level Level Level Total Marks

Abstract Windowing Tool Kit


1 2 4 6 12
(AWT)

2 Swing 2 2 6 10

3 Event Handling 2 2 8 12

4 Networking Basics 2 4 4 10

5 Interacting with Database 2 4 6 12

6 Servlets 4 4 6 14

Total 14 20 36 70

https://www.gunwantmankar.com
/ 4
Remove Watermark Wondershare
PDFelement

3.1. The delegation Event Model: Event sources, Event listeners.


3.2. Event classes: The ActionEvent class, the ItemEvent class, the
KeyEvent class, the MouseEvent class, the Text Event class, the
Window Event class
3.3. Adapter Classes.
3.4. Inner classes
3.5. Event Listener interfaces: ActionListener interface, ItemListener
interface, KeyListener interface, MouseMotion Interface,
TextListener Interface, Windows Listener Interface.

https://www.gunwantmankar.com
/ 5
Remove Watermark Wondershare
PDFelement

 Modern approach to handling events is based on the


“delegation event model”.

 Defines standard and consistent mechanisms to generate


and process event’s.

 “Source” generates an event and sends it to one or more


listeners.

https://www.gunwantmankar.com
/ 6
Remove Watermark Wondershare
PDFelement

 Event is an object that describes a state change in a source.


 Some action we have to performed when it is generated.
 Generated when user is interacted with components.
 Example: Pressing Button, Selecting item from list etc.
 It can be also generated when timer expires, counter value
exceeds, software and hardware failure etc.

https://www.gunwantmankar.com
/ 7
Remove Watermark Wondershare
PDFelement

 Source is an object that generates an event.


 This occurs when the internal state of that object
changes.
 Sources may generate more than one type of event.
 Sources must be register listener so that listener will receive
notifications.
 For Register/add:
 public void addTypeListener(TypeListener el)

 For remove:
 public void removeTypeListener(TypeListener el)

https://www.gunwantmankar.com
/ 8
Remove Watermark Wondershare
PDFelement

 Listener is an object that is notified when an event occurs.

 Two requirements:
 It must have been registered with one or more sources to

receive notifications.
 It must implement methods to receive and process these

notifications.

https://www.gunwantmankar.com
/ 9
Remove Watermark Wondershare
PDFelement

 Event Classes are core of Java’s event handling


mechanism.
 EventObject is the root of the Java event class
hierarchy which is present in java.util.
 It is the superclass for all events.
 Constructor: EventObject(Object src).
 EventObject class has defines two methods:
 Object getSource( ) : method returns the source of the event.

 String toString( ) : returns string equivalent of the event.

Event Classes : AWTEvent


 AWTEvent is defined in java.awt package.
 It is a subclass of EventObject.
 It is the superclass of all AWT-based events.

https://www.gunwantmankar.com
/ 10
Remove Watermark Wondershare
PDFelement

 ActionEvent
 ComponentEvent
 ContainerEvent
 FocusEvent
 ItemEvent
 KeyEvent
 MouseEvent
 TextEvent
 WindowEvent

1
1
https://www.gunwantmankar.com
/ 1
Remove Watermark Wondershare
PDFelement

 Generated when a button is pressed, a list item is double-


clicked, or a menu item is selected.
 ActionEvent class defines four integer constants that can be
used to identify any modifiers associated with an action
event:
 ALT_MASK, (8)

 CTRL_MASK, (2)

 META_MASK, (4)

 SHIFT_MASK. (1)

 In addition, an integer constant,


ACTION_PERFORMED (1001), which can be used to
identify action events.

https://www.gunwantmankar.com
/ 12
Remove Watermark Wondershare
PDFelement

 Constructors:
 ActionEvent(Object src, int type, String cmd)
 ActionEvent(Object src, int type, String cmd, int modifiers)
 ActionEvent(Object src, int type, String cmd, long when, int
modifiers)
 src: object which generate event
 type: type of event
 cmd: Command string
 modifiers: which modifier key
 when: when the event occurred

 getActionCommand() used to get command name.


 int getModifiers() used to get modifier key.
 long getWhen( ) used to get when event generated.

https://www.gunwantmankar.com
/ 13
Remove Watermark Wondershare
PDFelement

 ItemEvent is generated when a check box or a list item is clicked


or when a checkable menu item is selected or deselected.
 Item events:
 DESELECTED The user deselected an item.

 SELECTED The user selected an item.

 ITEM_STATE_CHANGED that signifies a change of state.

 Constructor:
 ItemEvent(ItemSelectable src, int type, Object entry, int state)

https://www.gunwantmankar.com
/ 14
Remove Watermark Wondershare
PDFelement

 KeyEvent is generated when keyboard input occurs.


 There are three types of key events:
 KEY_PRESSED,
 KEY_RELEASED, and
 KEY_TYPED
 Constructor:
 KeyEvent(Component src, int type, long when, int modifiers, int code)
 KeyEvent(Component src, int type, long when, int modifiers,
int code, char ch)

https://www.gunwantmankar.com
/ 15
Remove Watermark Wondershare
PDFelement

 Eight types of mouse events.


 The MouseEvent class defines the following integer constants
 MOUSE_CLICKED The user clicked the mouse.

 MOUSE_DRAGGED The user dragged the mouse.

 MOUSE_ENTERED The mouse entered a component.

 MOUSE_EXITED The mouse exited from a component.

 MOUSE_MOVED The mouse moved.

 MOUSE_PRESSED The mouse was pressed.

 MOUSE_RELEASED The mouse was released.

 MOUSE_WHEEL The mouse wheel was moved

 MouseEvent is a subclass of InputEvent.


 Constructor:
 MouseEvent(Component src, int type, long when, int

modifiers, int x, int y, int clicks, boolean triggersPopup)


https://www.gunwantmankar.com
/ 16
Remove Watermark Wondershare
PDFelement

 These are generated by text fields and text areas when characters are
entered by a user or program.
 TextEvent defines the integer constant
TEXT_VALUE_CHANGED.
 Constructor:
 TextEvent(Object src, int type)

https://www.gunwantmankar.com
/ 17
Remove Watermark Wondershare
PDFelement

 There are ten types of window events.


 WindowEvent class defines integer constants:
 WINDOW_ACTIVATED The window was activated.

 WINDOW_CLOSED The window has been closed.

 WINDOW_CLOSING The user requested that the window be closed.

 WINDOW_DEACTIVATED The window was deactivated.

 WINDOW_DEICONIFIED The window deiconified (min => Normal).

 WINDOW_GAINED_FOCUS The window gained input focus.

 WINDOW_ICONIFIED The window was iconified(Normal=>min)

 WINDOW_LOST_FOCUS The window lost input focus.

 WINDOW_OPENED The window was opened.

 WINDOW_STATE_CHANGED The state of the window changed.

https://www.gunwantmankar.com
/ 18
Remove Watermark Wondershare
PDFelement

 WindowEvent is a subclass of ComponentEvent.

 WindowEvent(Window src, int type, Window other)


 WindowEvent(Window src, int type, int fromState, int toState)
 WindowEvent(Window src, int type, Window other, int
fromState, int toState)

https://www.gunwantmankar.com
/ 19
Remove Watermark Wondershare
PDFelement

 An adapter class provides an empty implementation of all methods in an event


listener interface.
 Adapter classes are useful when you want to receive and process only some of the
events that are handled by a particular event listener interface.

 ComponentAdapter  ComponentListener
 ContainerAdapter  ContainerListener
 FocusAdapter  FocusListener
 KeyAdapter  KeyListener
 MouseAdapter  MouseListener
 MouseMotionAdapter  MouseMotionListener
 WindowAdapter  WindowListener

https://www.gunwantmankar.com
/ 20
Remove Watermark Wondershare
PDFelement

 Inner class is class which defined in another class.


 In inner classes, the Adapter class will defined in same class.
 No need of passing reference of object as it is in same scope.

https://www.gunwantmankar.com
/ 21
Remove Watermark Wondershare
PDFelement

 Event Delegation Model has two parts: Sources and


Listeners.
 When event generated, then event source invoked
appropriate method defined by interface.

https://www.gunwantmankar.com
/ 22
Remove Watermark Wondershare
PDFelement

 Defines one method to receive action events.


 void actionPerformed(ActionEvent ae)

https://www.gunwantmankar.com
/ 23
Remove Watermark Wondershare
PDFelement

 Defines one method to recognize when the state of an item


changes.
 void itemStateChanged(ItemEvent ie)

https://www.gunwantmankar.com
/ 24
Remove Watermark Wondershare
PDFelement

 Defines three methods to recognize when a key is pressed, released,


or typed.
 void keyPressed(KeyEvent ke)
 void keyReleased(KeyEvent ke)
 void keyTyped(KeyEvent ke)

https://www.gunwantmankar.com
/ 25
Remove Watermark Wondershare
PDFelement

 Defines five methods to recognize when the mouse is clicked,


enters a component, exits a component, is pressed, or is released.
 void mouseClicked(MouseEvent me)

 void mouseEntered(MouseEvent me)

 void mouseExited(MouseEvent me)

 void mousePressed(MouseEvent me)

 void mouseReleased(MouseEvent me)

https://www.gunwantmankar.com
/ 26
Remove Watermark Wondershare
PDFelement

 Defines two methods to recognize when the mouse is dragged or


moved.
 void mouseDragged(MouseEvent me)

 void mouseMoved(MouseEvent me)

https://www.gunwantmankar.com
/ 27
Remove Watermark Wondershare
PDFelement

 Defines one method to recognize when a text value changes.


 void textValueChanged(TextEvent te)

https://www.gunwantmankar.com
/ 28
Remove Watermark Wondershare
PDFelement

 Defines seven methods to recognize:


 void windowActivated(WindowEvent we)

 void windowClosed(WindowEvent we)

 void windowClosing(WindowEvent we)

 void windowDeactivated(WindowEvent we)

 void windowDeiconified(WindowEvent we)

 void windowIconified(WindowEvent we)

 void windowOpened(WindowEvent we)

https://www.gunwantmankar.com
/ 29
Remove Watermark Wondershare
PDFelement

https://www.gunwantmankar.com
/ 30

You might also like