answersLogoWhite

0

Event HandlingWhen the user acts on a Component -- clicking it or pressing the Return key, for example -- an Event object is created. The AWT event-handling system passes the Event up the Component hierarchy, giving each Component a chance to react to the event before the platform-dependent code that implements the Component fully processes it.

Each Component's event handler can react to an event in any of the following ways:

  • By ignoring the event and allowing it to be passed up the Component hierarchy. This is what the default Component implementation does. For example, since the TextField class and its TextComponent superclass implement no event handlers, TextFields get the default Component implementation. So when a TextField receives an Event, it ignores it and allows its container to handle it.
  • By modifying the Event instance before it goes further up the hierarchy. For example, a TextField subclass that displays all letters in uppercase might react to the keypress of a lowercase letter by changing the Event to contain the uppercase version of the letter.
  • By reacting in some other way to the event. For example, a TextField subclass (or a TextField's container) could react to a Return keypress by calling a method that processes the text field's contents.
  • By intercepting the event, stopping it from being processed further. For example, if an invalid character is entered in a text field, an event handler could simply stop the resulting Event from propagating upward. As a result, the platform-dependent implementation of the text field would never see the event.

From a Component's view, the AWT event-handling system is more like an event-filtering system. Platform-dependent code generates an event, but Components get a chance to modify, react to, or intercept the event before the platform-dependent code fully processes the event.

User Avatar

Wiki User

13y ago

What else can I help you with?

Related Questions

When two or more objects are added as listeners for the same event which listener is invoked first to handle the event?

First to arrive at the event.


Event Meeting Planning?

If you are responsible for your company's event meeting planning duties, you may be better off hiring an outside party or event specialist, that will handle the small details for you.


5 Star Event Services?

When you have a special event that you know has to go off without a single hitch, consider hiring 5 star event services. Let someone else handle all the details.


Careers Event Planning?

Events for your office or company are so much easier and more enjoyable when you hire careers event planning specialists. Let the professionals handle it.


How can you handle conversation monopolizers during a networking event?

Yes, you should act professionally with these things all the time. But you should tell them upfront that it has limits too.


Outdoor Umbrella Table for Entertaining?

The largest sized table that is available for an outdoor umbrella can handle up to ten chairs. It would be great for a large event.


Difference between fault tree analysis and event tree analysis?

Difference between fault tree and event tree: 1) Fault trees lay out relationships among event whereas event trees lay out sequences of events linked by conditional probabilities. 2) Event trees can handle better notions of continuity (logical, temporal, and physical), whereas fault trees are most powerful in identifying and simplifying failure scenarios.


What is an event counter?

An event counter is a variable that starts off set to zero and is incremented at a certain point in code which is passed when something (the event) is occurring. For example, if you want an event counter to determine how many times the user responds to the question "what was the student's grade" with the answer "100", then within the existing loop to handle data entry, you could simply add something along the lines of (if grade equals to 100 then event_counter = event_counter + 1) and there you have an event counter.


What do you mean by event in dotnet?

An "event" in .Net is an implementation of the Observer design pattern. When you declare that one of your classes has an event, you declare the name of the event, and the arguments that the event will pass. Then, your other classes can "Observe" when this event happens, and handle the event when it is "Fired".For example, the Button windows control has a "Click" event. You can then write code that watches for those clicks, and runs when it happens.An event in C# is a way for a class to provide notifications to clients of that class when some interesting thing happens to an object. The most familiar use for events is in graphical user interfaces; typically, the classes that represent controls in the interface have events that are notified when the user does something to the control (for example, click a button).


How do you properly use a beer keg pump tap to dispense beer at a party or event?

To properly use a beer keg pump tap to dispense beer at a party or event, first ensure the keg is properly chilled. Attach the tap to the keg by twisting it on securely. Pump the handle to pressurize the keg and then pull the handle to dispense beer. Make sure to pour at a steady pace to avoid excessive foam. Enjoy responsibly!


Event Planning: What is it and How to Manage?

Event planning involves organizing and coordinating all aspects of an event, from choosing a venue to managing vendors, decorations, and timelines. Effective event management ensures everything runs smoothly, creating a memorable experience. To successfully manage an event, clear goals, detailed planning, and team coordination are essential. Partnering with an experienced event management company can make the process seamless; for instance, Golden Aster Event, a leading event management company in Kolkata, offers comprehensive solutions. They handle everything from concept to execution, ensuring your event is flawless and memorable. Choosing the right professionals like Golden Aster Event can make your event truly special.


How many power ranger in power rangers?

As of Dino Charge counting the Aqua Ranger and the Silver Ranger but not the Talon Ranger there are a total of 129 Rangers in the event that you are just counting the actual powers but there are a total of 120 Rangers in the event that you are counting the characters themselves that handle the powers.