Latest Tutorials| Questions and Answers|Ask Questions?|Site Map



Home Answers Viewqa Java-Interview-Questions Java event delegation model

Have Programming Question? Ask it here!
 
 
 


samar
Java event delegation model
1 Answer(s)      3 years and 10 months ago
Posted in : Java Interview Questions


What is the highest-level event class of the event-delegation model?

Advertisement
View Answers

April 12, 2012 at 2:03 PM


Event delegation model has 3 components these are Event,Listener and Source..

Events

In the delegation model, an event is an object that describes a state change in a source. Event be generated as a consequence of a person interacting with the elements in a graphical user interface. Some of the activities that cause events to be generated are pressing a button, entering a character via the keyboard, selecting an item in a list, and clicking the mouse. Events may also occur that are not directly caused by interactions with a user interface like an event may be generated when a timer expires, a counter exceeds a value, a software or hardware failure occurs, or an operation is completed.

Event Source


A source is an object that generates an event. This occurs when the internal state of that object changes in some way. Sources may generate more than one type of event. A source must register listeners in order for the listeners to receive notifications about a specific type of event. Each type of event has its own registration method. public void addTypeListener(TypeListener el) Type is the name of the event and el is a reference to the event listener. The method that registers a keyboard event listener is called addKeyListener(). The method that registers a mouse motion listener is called addMouseMotionListener().
When an event occurs, all registered listeners are notified and receive a copy of the event object know as multicasting the event In all cases, notifications are sent only to listeners that register to receive them. Some sources may allow only one listener to register. General Form: public void addTypeListener(TypeListener el) throws java.util.TooManyListenersException Type is the name of the event and el is a reference to the event listener. When such an event occurs, the registered listener is notified. This is known as unicasting the event. A source must also provide a method that allows a listener to unregister an interest in a specific type of event. The general form of such a method is this: public void removeTypeListener(TypeListener el)

Event Listener


A listener is an object that is notified when an event occurs. Listener has two major requirements. It must have been registered with one or more sources to receive notifications about specific types of events. It must implement methods to receive and process these notifications. The methods that receive and process events are defined in a set of interfaces found in java.awt.event. For example, the MouseMotionListener interface defines two methods to receive notifications when the mouse is dragged or moved. Any object may receive and process one or both of these events if it provides an implementation of this interface.



Related Tutorials/Questions & Answers:
Java event-delegation model
Java event-delegation model  What is the advantage of the event-delegation model over the earlier eventinheritance model
Java event delegation model
Java event delegation model  What is the highest-level event class of the event-delegation model
Advertisements
delegation event model
delegation event model  What is delegation event model?   delegation event model In the event-delegation model, specific objects...-listener interfaces. Advantages of event-delegation model: 1)It enables
Java single threaded model
Java single threaded model  How single threaded model works after implementation in class, basically architecture point of view
Java event handling
Java event handling  What event results from the clicking of a button
Java event-listener
Java event-listener  What is the relationship between an event-listener interface and an event-adapter class
Java: Rainfall Model
Java NotesRainfall Model 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42
Java event handling
Java event handling  Which java.util classes and interfaces support event handling
Java event handling
Java event handling  What is the purpose of the enableEvents() method
Java AWT event hierarchy
Java AWT event hierarchy  What class is the top of the AWT event hierarchy?  The java.awt.AWTEvent class is the highest-level class in the AWT event-class hierarchy
Need an Example of calendar event in java
Need an Example of calendar event in java  can somebody give me an example of calendar event of java
mouse event - Java Beginners
=getContentPane(); setLayout(new FlowLayout()); setTitle("Mouse Event... Event"); f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); f.add(btnClose
Event handling - Java Beginners
Event handling  Hi, This is a similar kind of question i had asked before, with a little difference. Two JCombobox and a JtextField. When I select an Item from the first Combo(i.e.,Select,First,Second or Third),the set
Event Handling - Java Beginners
Event Handling  import javax.swing.*; import java.awt.*; import java.awt.event.*; public class Calculator extends JFrame { JLabel lblNumber=new JLabel("Number"); JLabel lblSquareRoot=new JLabel("Square Root
Java window state event
Java window state event  Two java windows, one on top of another... Window at the back is deactivated when the other is on the top. Can iconify when there is only one window using win+d key. In windows, press win+d, window
java swing button click event
java swing button click event  java swing button click event   public void doClick()   Java Swing Tutorials
need model coding in java - Java Beginners
need model coding in java  i want model a program for an algorithm in java which is it has some transactions T1=ABCE T2=CDE T3=DE T4=CDEG T5=BG T6=AE T7=BCG T8=C T9=A now compare T9=A and T6=AE
Java Model View Controller (MVC) Design Pattern
; margin-left: 400px; } .style4 { margin-left: 160px; } Java MVC ( Model View Controller ) Design Pattern Model View controller is a classical design... into three parts. 1. Model- This component manages the information and notify
Event Handling In Java
Event Handling In Java In this section you will learn about how to handle.... In Java event handling may comprised the following four classes : Event Sources : Sources for generating an event may be the components. In Java
is having any method same behavior of Single thread model in java?
is having any method same behavior of Single thread model in java?  is having any method same behavior of Single thread model in java
is having any method same behavior of Single thread model in java?
is having any method same behavior of Single thread model in java?  is having any method same behavior of Single thread model in java
is having any method same behavior of Single thread model in java?
is having any method same behavior of Single thread model in java?  is having any method same behavior of Single thread model in java
is having any method same behavior of Single thread model in java?
is having any method same behavior of Single thread model in java?  is having any method same behavior of Single thread model in java
event-driven programming paradigm of Java. - Java Beginners
event-driven programming paradigm of Java.  Design a scientific calculator using event-driven programming paradigm of Java.  Hi Friend, Please visit the following link: http://www.roseindia.net/tutorial/java/swing
JComboBox Event Handling - Java Beginners
JComboBox Event Handling  Hi, I have problem with event handling here.There are Two JComboBox and a JTextField.When I select an item in first combo(Select,First,Second in the below program) the items in the second combo change
Java Swing Key Event
Java Swing Key Event In this tutorial, you will learn how to perform key event in java swing. Here is an example that change the case of characters to uppercase as the user enters any character. The given code accepts the string from
What are events? Explain how Event handling in Java?
What are events? Explain how Event handling in Java?  What are events? Explain how Event handling in Java?   Hi, The Events..., and introduces us to AWT event handling. For Details about Event Handling in Java
Handling Key Press Event in Java
Handling Key Press Event in Java   ... the handling key press event in java. Key Press is the event is generated when you press any key to the specific component. This event is performed by the KeyListener
Model in struts
Model in struts  what is a model in struts
Introduction to POJO (Plain Old Java Object) Programming Model
Introduction to POJO (Plain Old Java Object) Programming Model... features of added by Sun Microsystems in EJB 3.0 is POJO (Plain Old Java Object). It is a Java object that doesn't extend or implement some specialized
Return Value From Event - Java Beginners
Return Value From Event  I would like to call a method that returns a value after an event has occurred and the value is determined by the event or listener. eg: public int mymethod() { static int value=0; KeyAdapter
Java - Event Listeners Example in Java Applet
Java - Event Listeners Example in Java Applet       Introduction The event listener is the feature of java that handles the several events for the several
Event management
Event management   Hi, I want event management application like maintaining email notifications while task creation and update in broader way using spring java
Event on Slide bar In Java
Event on Slide bar In Java       Introduction In this section, you will learn about the event handling for a swing component named Slide bar. This section provides a complete
event handling
event handling  diff btwn event handling in ASP.net and in HTML
Networking with OSI model
Networking with OSI model  What is networking and it's how to work with OSI model?   Please visit the following links: http://www.roseindia.net/java/network/index.shtml http://www.roseindia.net/technology/networking
Click event
Click event  hi............ how to put a click event on a particular image, so that it can allow to open another form or allow to display result in tabular form????????/ can u tell me how to do that????????/ using java swings
Validate JTexField with date on Text Changed event - Java Beginners
Validate JTexField with date on Text Changed event  Hello Sir I want to only Validate date in MM/DD/YYYY Format on TextChanged Event,date will automatically set through MM with two digits,then cursor will automatically set
Presentation-Model Structure
Java NotesPresentation-Model Structure Previous - Big Blob, Next - MVC... interface from the model (business logic, domain, ...). This provides a huge... of the complications by simply sticking to the Presentation-Model organization
Event in flex
Event in flex  Hi..... can you tell me about that How do you make component participate in event mechanism? Thanks   Ans: Extend EventDispatcher or any subclass of it or implement IEventDispatcher
Flex event
Flex event  Hi.... please tell me about How does Flex event system works? Thanks  Ans: When event are triggered there are three...: In the capturing phase, Flex examines an event target?s ancestors in the display list to see
Event in flex
Event in flex  Hi..... I want to know about What does calling preventDefault() on an event do? How is this enforced? please give me an example for that Thanks   Ans: The methods of the Event class can be used
Event handling in Java AWT
Event handling in Java AWT     ... events in java awt. Here, this is done through the java.awt.*; package of java. Events are the integral part of the java platform. You can see the concepts
Flex event
Flex event  Hi.... Please tell me about How to create your own event in flex? Thanks
Flex event
Flex event  Hi... please give me the answer with example What is event Bubbling? Thanks in advance  Event Bubbling: In the bubbling phase, Flex examines an event?s ancestors for event listeners. Flex starts
Flex event
Flex event  hi...... How to capture and event if the component is disabled? please give an example..... Thanks in advance
spring Model class
spring Model class  how to connect database in spring MVC ,sample model class and diplay results from database   Have a look at the following link: http://www.roseindia.net/spring/jdbc-template-batch-update.shtml
Single thread model - Struts
Single thread model  Hi Friedns , thank u in advance 1)I need sample code to find and remove duplicates in arraylist and hashmap. 2) In struts, ow to implement singlthread model and threadsafe
why java ignore backspace event when there are more then 1 keychar for a single keystroke.
why java ignore backspace event when there are more then 1 keychar for a single keystroke.  why java ignore backspace event when there are more then 1 keychar for a single keystroke. Assume that i have a text field to get
JSP Architecture, JSP Model 1 architecture, JSP Model 2 architecture
. In the JSP page programmers embeds Java code for generating dynamic content. JSP... of the architecture is used. These architectures are known as Model 1 and Model 2 architectures. So, in JSP there are two types of architecture of the JSP: Model 1
Advertisements
 

 

 

DMCA.com