Tuesday, March 3, 2009

AWT Swing Event Pumping and Targeting

I'm currently learning Swing, and thus AWT. In the post "Debug Listeners on AWT/Swing components", I wrote a little piece of code that can help with understanding what events are fired on a component.

This is a further dive into the lower level elements of the event system of AWT/Swing. I wrote this as research notes for myself, but have then tried to edit it into something more readable, hoping that a wider audience than me alone can get any value from it.

Intended audience: Somewhat experienced developers of the type that likes to know how things really work, and who subscribe to Joel's law of Leaky Abstractions. If you're a AWT/Swing guru that for example know how the current version of AWT handles the AWT 1.0 event model and where exactly in the event dispatch and processing chain the AWTEventListeners are invoked, you probably don't need this. If you've never written some hello world for Swing, it might be too early - but you could skim it nevertheless, to know if it will be interesting for you later.

In the following text, which is a long article more than a blogpost, I ended up covering quite a bit. The main elements are:
  1. Basics of AWTEvents, low-level events and semantic (high-level) events.
  2. Event pumping, Operating System to Java interaction and the transfer of events.
  3. Event dispatching, Event Dispatch Thread ("EDT")
  4. Event processing.
  5. InputEvent (mouse and keyboard) retargeting, Focus subsystem
  6. Some misc topics: Coalescing, AWTEventListeners, Key Bindings, and how semantic events are produced and dispatched (Spring's MVC logic).
Please be advised that there might be places where I haven't understood things correctly! The text is neither supposed to be a complete discussion of all the intricacies of Swing/AWT. However, the text might hopefully, for some level of developers, shed light on some elements of "how it really works". The text is supposed to progress in a somewhat orderly fashion - if it doesn't, just read it a couple of times more! If you have any corrections, ideas for making it easier to understand this stuff, or otherwise have any suggestions, please comment - or send an email to Endre@Stolsvik.com.

The text contains a bunch of stacktraces. These are taken from runs on Java 1.6.0_12. However, these parts of the code don't change radically from version to version, and the overall discussion and even the stacktraces (less the exact line numbers) will probably still be relevant in some years from now.

Basics

Different types of events: The event system comprises two distinct types of events: Low-level events, and Semantic events. The low-level events all extend ComponentEvent, while the semantic events are all others, for example ActionEvent, AdjustmentEvent, ItemEvent, TextEvent and others. The low-level events are direct events concerning the GUI system and represent window-system occurrences or low-level input, like a window being moved or minimized, a key being pressed on the keyboard, the mouse being moved, a mousebutton being clicked. The semantic events, on the other side, pretty much all describe changes of state on Components, like a button being clicked, a menu item being choosen, text being entered into a field. Semantic events are typically constructed and dispatched by the components themselves based on low-level events.

Here's a rather old (Feb 1997) article from Sun: "Java AWT: Delegation Event Model", concerning the change from Java 1.0 event model to the Java 1.1 delegation event model. This model is still the one being employed, and the article is a rather easy read - just decide if the historic parts are worth paying attention to or not. Here's a link to the Swing UI tutorial about these two kinds of events: "Concepts: Low-Level Events and Semantic Events". Here's a link to the event package JavaDoc: Package java.awt.event.

This article will primarily concern the low-level events.

All AWT/Swing events are of supertype AWTEvent: The events fired on the different listeners are extensions of AWTEvent, for example MouseEvent, and the specific subtype of mouse event is communicated by which of the different methods on the MouseListener (or MouseMotionListener or MouseWheelListener) is invoked, for example MouseListener.mouseClicked(MouseEvent e). AWTEvent also has a method getID() that describes which type (e.g. "mouse") and subtype (e.g. "mouse moved") the event is (MouseEvent ids starts at 500, and MOUSE_MOVED is 503). AWTEvent is a subclass of Event, which has a getSource() method. The source always refers to the component "in question": Low-level events originate from the windowing system, and the source is the component that got or will get the Event, and it can thus quite cleanly be thought of as the target. High-level events are typically created by the components themselves, and are thus originating from that component, making "source" correcter. When processing events, the EventDispatchThread, which is discussed later, directly invokes getSource() on the event, and then invokes source.dispatchEvent(event). The specific event classes add event type specific stuff, for example MouseEvent which amongst others has methods getLocationOnScreen() and getButton().

Here's the Sun tutorials index for EventListeners: "Lesson: Writing Event Listeners", which has lots of good information that hopefully will make even more sense after reading this article. In particular the listing in "Listeners Supported by Swing Components" is good for an overview or index over what event listeners are supported by which components. Note how it divides the list into low-level events ("Listeners that All Swing Components Support" - the AWT events) and higher-level semantic event listeners ("Other Listeners that Swing Components Support"). From this page you can get a pdf of Chapter 9 of the book "Mastering the JFC: AWT, Volume 1", which is a 2001 book but which still is relevant.

From the Operating System to the MouseListener

Native Event Loop: The Toolkit implementation and its corresponding event pumping thread is the native connection to the underlying operating system, and is thus specific for each operating system. Inside the Toolkit thread event loop, extension classes of AWTEvent (e.g. MouseEvent) are instantiated and posted to the EventQueue. The source is set to the appropriate AWT Window: For example, for KeyEvents, this is the active window, while for MouseEvents, it is the window below the mouse. The AWTEvent is "posted" to the java side by some roundabout ways which effectively ends up in an invocation of EventQueue.postEvent(AWTEvent). The specific Toolkit instance along with the toolkit thread forms the native side of the GUI event pumping.

The source code for the native Toolkit implementations aren't available in the standard SDK distribution. Here's a link to WToolkit, the Windows Toolkit implementation. Notice the bunch of native methods. Notice the native method eventLoop() at line 303 and the call to this from the Runnable of the "AWT-Windows" thread at line 289.

Here's a stacktrace of a posting of a MouseEvent.MOUSE_MOVED event from the native Toolkit thread, named "AWT-Windows". Notice how it doesn't post it directly onto the EventQueue, but rather onto a "intermediate storage point" called PostEventQueue:

 Daemon Thread [AWT-Windows]
  sun.awt.PostEventQueue.postEvent(java.awt.AWTEvent) line: 2083
  sun.awt.SunToolkit.postEvent(sun.awt.AppContext, java.awt.AWTEvent) line: 591
  sun.awt.windows.WFramePeer(sun.awt.windows.WComponentPeer).postEvent(java.awt.AWTEvent) line: 722
  sun.awt.windows.WToolkit.eventLoop() line: not available [native method] [local variables unavailable]
  sun.awt.windows.WToolkit.run() line: 291 java.lang.Thread.run() line: 619

Java Event Loop: The EventDispatchThread ("EDT") is a thread that basically repeatedly invokes EventDispatchThread.pumpOneEventForFilters(int id) in a loop. This again invokes EventQueue.dispatchEvent(AWTEvent e). The EventQueue and EventDispatchThread together forms the java side of the event pumping. Upon dispatch, the EventQueue does checks what type of Event is being handled. ActiveEvents has a method dispatch() which is invoked directly. If the source of the AWTEvent is a Component, this component has its dispatchEvent(AWTEvent) invoked with the event as the argument.

The EventQueue gets events posted either from the native Toolkit thread or from the application code ("userland"). EventQueue.invokeLater(Runnable) and invokeAndWait(Runnable) posts an event to the EventQueue. Such events will be of type InvocationEvent (which is an ActiveEvent). It is also possible to directly post events onto the queue, as such: Toolkit.getDefaultToolkit().getSystemEventQueue().postEvent(event), but getting the EventQueue might be denied by the call to System.getSecurityManager().checkAwtEventQueueAccess(). Note that a lot of event firing, particularly for the higher-level events (the Semantic events), doesn't go through the EventQueue. For example, if a JButton is clicked, the generated ActionEvent is never posted to the EventQueue, but instead fired on the button's ActionListeners directly ("directly" is relative; The event is fired through or rather by Swing's Model-View-Controller paradigm, but still not through the EventQueue - more on this later).

Continuing on the MouseEvent.MOUSE_MOVED example started above: The EventQueue is notify'ed, leading to a flush of events from the PostEventQueue into the EventQueue. The thread here is the java side, the EventDispatchThread, named "AWT-EventQueue-0" (The zero at the end of the name is increased if this thread crashes, in which case a new one is created when the next event is posted by the Toolkit, and also increased for modal dialogs):

 Thread [AWT-EventQueue-0]
  java.awt.EventQueue.postEvent(java.awt.AWTEvent, int) line: 244
  java.awt.EventQueue.postEventPrivate(java.awt.AWTEvent) line: 202
  java.awt.EventQueue.postEvent(java.awt.AWTEvent) line: 175
  sun.awt.PostEventQueue.flush() line: 2072
  sun.awt.SunToolkit.flushPendingEvents() line: 626
  java.awt.EventQueue.getNextEvent() line: 465
  java.awt.EventDispatchThread.pumpOneEventForFilters(int) line: 236
  java.awt.EventDispatchThread.pumpEventsForFilter(int, java.awt.Conditional, java.awt.EventFilter) line: 184
  java.awt.EventDispatchThread.pumpEventsForHierarchy(int, java.awt.Conditional, java.awt.Component) line: 174
  java.awt.EventDispatchThread.pumpEvents(int, java.awt.Conditional) line: 169
  java.awt.EventDispatchThread.pumpEvents(java.awt.Conditional) line: 161
  java.awt.EventDispatchThread.run() line: 122

Two-thread event pump: Notice how there are thus two completely separate threads doing event pumping: One running on the native side, the Toolkit thread, pumping events from the native operating system "over to java" via posting to an intermediate PostEventQueue class, and then notifying the java side via the EventQueue. On the java side, we have the EventDispatchThread that waits on the EventQueue. When it gets a notify, it first flushes any new events from the native side into the EventQueue proper, and then pumps from the EventQueue.

Dispatching on the AWT and Swing Components: The main dispatching method on to the AWT/Swing component side is Component.dispatchEvent(AWTEvent e), which is final, but invokes Component.dispatchEventImpl(AWTEvent) which is package-private and is overridden by Container and furthermore by Window. Handled events in these overrides include ComponentEvent.COMPONENT_RESIZED for Windows, in which case it invalidates and validates before passing on to super, and resize and move events for Container, in which case it produces HierarchyEvent.ANCESTOR_[RESIZED|MOVED] for its children, after it has invoked super. However, Container also takes care of all MouseEvents, doing retargeting and redispatch, which we will come back to.

The Component.dispatchEventImpl(AWTEvent) is a rather long method that handles different aspects of different events, divided into steps. It takes care of a lot of special cases, both because of special requirements for some types of events, for the KeyboardFocusManager and lightweight component retargeting for events handled by focus, and for flexibility, but also because of lots of cruft in the event handling accumulated throughout the years (In particular this goes for the Java 1.0 AWT style of event handling (explained in the article "Java AWT: Delegation Event Model" referenced above) whereby one had to subclass a component to get events, which then were delivered by the Component's "self-invocation" of for example the overridden Component.mouseDown(Event e)). The Component.dispatchEventImpl(e) are nicely commented inline, clearly showing each stage of the dispatch. Unless some special case kicks in (of which there are many, in particular input event retargeting, described shortly), the method processEvent(e) is eventually invoked in step "6. Deliver event for normal processing", but only if Component.eventEnabled(AWTEvent e) returns true. This method returns true if either the event-type specific listener field is non-null, or if the eventMask, set by enableEvents(long), says so. The processing is described shortly.

InputEvents (re)targeting: The (currently) two types of InputEvents have distinct targeting logic, meaning which Component's Listeners shall be invoked. MouseEvents goes to the most specific ("deepest") child component residing under the mouse, while KeyEvents are sent to the focused window, routed using the KeyboardFocusManager to the focused component in this window.

MouseEvents targeting: Container overrides dispatchEventImpl(AWTEvent). Remember that Window is a Container. If the Container in question is a heavyweight component (i.e. it is not an instanceof LightweightPeer), this override takes care of finding the target for MouseEvents, attempting via an instance of the class LightweightDispatcher to forward/distribute MouseEvents to the most specific ("deepest") child, whether this is a heavyweight AWT Component, or a lightweight JComponent. These days this class has an incorrect name, since it also is responsible for retargeting MouseEvents to any heavyweight Components. (The class is package private, residing in Container.java).

To find the deepest component, Container.getMouseEventTarget(x, y ...) is invoked, which goes through each child component, finding the one that returns true for Component.contains(x, y). If the child is a Container, it recurses by invoking getMouseEventTarget(x - comp.x, y - comp.y ...) on the child (hence upholding the "illusion" that 0,0 is the local top left corner for all component). Since JComponents extends from Container, this method also checks itself after the recurse. The check mentioned is whether it wants any MouseEvents by testing whether the eventMask says so (mentioned above), or if any of the three types of mouse listeners are set (Mouse, MouseMotion, MouseWheel). The net effect is that the LightweightDispatcher thus finds the deepest Component which the mouse is currently over and which wants MouseEvents, retargets the event by making a new one, dispatches the new event instance directly, and consumes the original event instance. Or it finds that there are no such component, either because there physically aren't any components there (the window background is showing), or because the component don't want MouseEvents (for example a standard JLabel doesn't), in which case the LightweightDispatcher won't do anything (it won't consume the event), and the event will be dispatched as normal (on itself, the native Container, typically a Window).

LightweightDispatcher also tracks mouse enter and exits over lightweight components as the native system doesn't know about them and thus cannot make enter/exit events for them either. Also, if we're dragging, it hooks an AWTEventListener on the Toolkit (as mentioned below), so that it gets all further MouseEvents even though we drag across different boundaries of lightweight and heavyweight components.

If the original event is consumed, the LightweigthDispatcher dispatchEvent returns true, and the Container.dispatchEvent returns. If it doesn't consume the event (hence, it was no MouseEvent, or it was a MouseEvent targetted at the Container itself), it returns false, and the Container.dispatchEvents continues by invoking super.dispatchEventImpl(AWTEvent e), and hence normal dispatch ensues.

KeyEvent targeting / Focus Subsystem: As briefly mentioned, Component.dispatchEventImpl(e) also handles keyboard targeting: KeyboardFocusManager's static method retargetFocusEvent() is invoked, apparently to handle actual FOCUS_GAINED and FOCUS_LOST events. Then, the KeyboardFocusManager is statically asked for the current KeyboardFocusManager (I am not sure if it really is possible to entirely roll your own KFM, as the abstract class KFM specifically states several places that it depends on the code in DefaultKeyboardFocusManager), and dispatchEvent(e) is invoked on that. If this invocation returns true, the event was dispatched, and we are finished. It is possible to register KeyEventDispatcher instances on the KeyboardFocusManager, which can consume the event - the focused component is already established at that point, being set in the KeyEvent (getSource(), or rather getComponent() since it is a ComponentEvent - read towards the top, "All AWT/Swing events are of supertype AWTEvent"). Here's the Sun Java tutorial: "How to use the Focus Subsystem". For a in-depth description of the focus subsystem, read the article The AWT Focus Subsystem, referenced from the Component class and in particular its processKeyEvent method. This subsystem is somewhat complex, including logic about multiple focus cycle roots and how the different components are notified about focus gained and lost events. An interesting note is that if you end up in a more "inner" focus cycle root, there are by default no keypresses that can lift you out to the outer root again.

Note that for JComponents, there is another way to hook Actions to specific KeyStrokes, namely the InputMap/ActionMap system, which is described below.

Event processing on Component: As mentioned above, Component.processEvent(AWTEvent e) is eventually invoked. It has a bunch of "downstream" methods: process[Component|Focus|Key|Mouse[Motion|Wheel]|Input|Hierarchy[Bounds]]Event. All these methods can be overridden in subclasses, thus providing interesting (and non-trivial) hook-points. If you do override them, remember enableEvents(bitfield), described shortly. It is these downstream methods, for example processMouseEvent, that eventually invokes the listeners, for example MouseListener.

For any type of event, there can be several EventListeners on a Component. In the Component class, there is a sole field for each type, e.g. keyListener. Nullness of this field is used as indicator: If it is null, there is no listeners for that event type. If it is non-null, there is at least one. If there is one listener, it will be the actual listner. If there are several listener, the field will be an AWTEventMulticaster instance, which is a somewhat clever way of simply daisy-chaining a set of listeners of the same type into a string of listeners whose event fire methods all will be invoked when the AWTEventMulticaster's corresponding fire-method is invoked. AWTEventMulticaster obviously implements all types of AWT EventListeners. The order in which listeners of a specific type is invoked is indeterminate, thus if important, you must handle this in some way yourself.

Events are not delivered to a Component unless there are at least one listener for this event, or if enableEvents(long eventsToEnable) is invoked (in which case processEvent(e) is invoked even though there are no listeners for that type). The long is a bit-mask, composed by ORing together the constants in AWTEvent. The process[Type]Event does the null-check on the corresponding typeListener field, returning immediately if null. If non-null, it invokes the correct method on the TypeListener based on a switch on event.getID(). All process[*]Event methods are protected and non-final, hence overridable for subclasses.

MouseEvent.mouseClicked: Here is a stacktrace for invocation of mouseClicked(e) on a MouseListener installed on a JLabel when I clicked the mouse. The stacktrace begins in the EventQueue where an event is pumped. It is dispatched on the Window instance where it goes to the Window and Container specific overrides of dispatchEventImpl. It is a MouseEvent, so it goes through the LightweightDispatcher where this MouseEvent is retargeted (a new MouseEvent is created, the old is consumed). The LightweigthDispatcher directly redispatches the new MouseEvent on the JLabel instance where it is processed. Finally, it ends up in the ExampleMouseListener as an invocation on its mouseClicked(e) method. (In this example, the JComponent also intervenes to handle "Autoscroll". This is a feature that enables moving of a scrollpane by dragging the content: If you setAutoscrolls(true), synthetic MouseDragged events will be made if you click inside the component and then drag the mouse, even though you drag it outside the component. The override of the processMouseEvent is to stop this feature when you release the mouse button.). Here's Sun's tutorial on MouseListeners: "How to write a Mouse Listener". The thread running is, as always for Java GUI stuff, the EventDispatchThread.

 Thread [AWT-EventQueue-0]
  com.example.ExampleMouseListener.mouseClicked(...)
  java.awt.Component.processMouseEvent(Component.java:6219)
  javax.swing.JComponent.processMouseEvent(JComponent.java:3265)
  java.awt.Component.processEvent(Component.java:5981)
  java.awt.Container.processEvent(Container.java:2041)
  java.awt.Component.dispatchEventImpl(Component.java:4583)
  java.awt.Container.dispatchEventImpl(Container.java:2099)
  java.awt.Component.dispatchEvent(Component.java:4413)
     ^^ This is a redispatch of a new MouseEvent, now on the JLabel, while the old event will be consumed.
  java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4556)
     ^^ It has now found the target Component: The JLabel
  java.awt.LightweightDispatcher.processMouseEvent(Container.java:4229)
  java.awt.LightweightDispatcher.dispatchEvent(Container.java:4150)
     ^^ The retargeting of the MouseEvent begins, by the LightweightDispatcher held by the Window instance.
  java.awt.Container.dispatchEventImpl(Container.java:2085)
  java.awt.Window.dispatchEventImpl(Window.java:2475)
  java.awt.Component.dispatchEvent(Component.java:4413)
     ^^ The initial dispatch, on the Window that holds the JLabel.
  java.awt.EventQueue.dispatchEvent(EventQueue.java:599)
  java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:269)    <-- "EDT pump" references!
  java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:184)
  java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:174)
  java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:169)
  java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:161)
  java.awt.EventDispatchThread.run(EventDispatchThread.java:122)

KeyEvent.keyTyped: To contrast, here's a stack trace for invocation of keyTyped(e) on a KeyListener installed on a JButton. I made the button focused (by clicking on it, or by tabbing to it), then hit a key. The event is processed the same up to the Container.dispatchEventImpl, where the event is not processed, and instead goes further to Component.dispatchEventImpl. Here, the KeyboardFocusManager kicks in since it is a KeyEvent, and does its magic focusing logic and where the KeyEvent is retargeted (a new KeyEvent is created, the old is consumed). The KeyboardFocusManager directly redispatches the new KeyEvent on the JButton, where it is processed. Finally, it ends up in the ExampleKeyListener as an invocation on its keyTyped(e) method. Here's Sun's tutorial on KeyListeners: "How to write a Key Listener".

 Thread [AWT-EventQueue-0]
  com.example.ExampleKeyListener.keyTyped(...)
  java.awt.Component.processKeyEvent(Component.java:6171)
  javax.swing.JComponent.processKeyEvent(JComponent.java:2799)
  java.awt.Component.processEvent(Component.java:5993)
  java.awt.Container.processEvent(Container.java:2041)
  java.awt.Component.dispatchEventImpl(Component.java:4583)
  java.awt.Container.dispatchEventImpl(Container.java:2099)
  java.awt.Component.dispatchEvent(Component.java:4413)
     ^^ This is a redispatch of a new KeyEvent, now on the JButton, while the old will be consumed.
  java.awt.KeyboardFocusManager.redispatchEvent(KeyboardFocusManager.java:1848)
     ^^ It has now found the target Component: The JButton
  java.awt.DefaultKeyboardFocusManager.dispatchKeyEvent(DefaultKeyboardFocusManager.java:704)
  java.awt.DefaultKeyboardFocusManager.preDispatchKeyEvent(DefaultKeyboardFocusManager.java:969)
  java.awt.DefaultKeyboardFocusManager.typeAheadAssertions(DefaultKeyboardFocusManager.java:841)
  java.awt.DefaultKeyboardFocusManager.dispatchEvent(DefaultKeyboardFocusManager.java:668)
     ^^ The retargeting of the KeyEvent begins, by the global KeyboardFocusManager
  java.awt.Component.dispatchEventImpl(Component.java:4455)
  java.awt.Container.dispatchEventImpl(Container.java:2099)
  java.awt.Window.dispatchEventImpl(Window.java:2475)
  java.awt.Component.dispatchEvent(Component.java:4413)
     ^^ The initial dispatch, on the Window that holds the JButton.
  java.awt.EventQueue.dispatchEvent(EventQueue.java:599)
     ["EDT pump"]


Misc topics

Coalescing: This is a mechanism whereby a bunch of e.g. mouse-move events are compressed into one. This is done by checking whether the event currently-being-posted-to-the-Event-Queue could be collapsed into an already-posted-but-not-yet-processed event. Earlier, this was a general system whereby the source ("target") component would possibly go through the entire eventqueue looking for same-type events, checking whether it could collapse them, but this has been deemed too slow. The EventQueue.coalesceOtherEvent method that takes care of this legacy has the following comment: "Should avoid of calling this method by any means as it's working time is dependant on EQ length. In the wors case this method alone can slow down the entire application 10 times by stalling the Event processing. Only here by backward compatibility reasons." The present system uses the field Component.eventCache, where five specific event types can be handled: PaintEvent.PAINT, PaintEvent.UPDATE, MouseEvent.MOUSE_MOVED and MouseEvent.MOUSE_DRAGGED, in addition to sun.awt.PeerEvent (which I don't know what is) which apparently handles coalescing itself (it also handles dispatching itself - it is an ActiveEvent, specifically an extension of InvocationEvent). The coalescing is as dumb (and fast) as possible: mouse events are coalesced by keeping the latter event, while the paint events are coelesced by checking whether one or the other "update rect" is contained in the opposite, in which case it returns the containing, or else it doesn't coalesce.

AWTEventListener, "Event spying": On the Toolkit, one may install a "global listener" to spy on all low-level events that are dispatched from the EventQueue onto some Component: Toolkit.getDefaultToolkit().addAWTEventListener(listener, long eventMask), where the eventMask is the same bit-mask described Component.enableEvents(...) above. Adding an AWTEventListener might be denined by the call to System.getSecurityManager().checkPermission(SecurityConstants.ALL_AWT_EVENTS_PERMISSION).

This is a stacktrace when such an AWTEventListener is invoked, also on the EventDispatchThread, illustrating both the EventQueue and the run through the dispatching on the Window, Container, Component. The invocation of AWTEventListeners are done early in the Component.dispatchEventImpl, at step "2. Allow the Toolkit to pass this to AWTEventListeners", which makes it possible for a AWTEventListener to consume the event early and thereby stop the dispatch process from going further.

 Thread [AWT-EventQueue-0]
  com.example.ExampleAWTEventListener.eventDispatched(...)
  java.awt.Toolkit$SelectiveAWTEventListener.eventDispatched(Toolkit.java:2353)
  java.awt.Toolkit$ToolkitEventMulticaster.eventDispatched(Toolkit.java:2244)
  java.awt.Toolkit.notifyAWTEventListeners(Toolkit.java:2203)
     ^^ The Toolkit is invoked to pass the event through the AWTEventListeners.
  java.awt.Component.dispatchEventImpl(Component.java:4481)
  java.awt.Container.dispatchEventImpl(Container.java:2099)
  java.awt.Window.dispatchEventImpl(Window.java:2475)
  java.awt.Component.dispatchEvent(Component.java:4413)
  java.awt.EventQueue.dispatchEvent(EventQueue.java:599)
     ["EDT pump"]

Key Bindings / Keyboard handling by InputMap and ActionMap: Swing components, JComponents, have one more way of handling KeyEvents: The InputMap and ActionMap. The InputMap defines a Map between KeyStrokes and "actionMapKeys" which (typically) are Strings that describes what this key does, while the ActionMap defines a Map between those actionMapKeys and some Action. Note that the actionMapKey arguement type is Object, but it is custom to use Strings so that these Maps become "self documenting".

Read the JavaDoc of the static methods on KeyStroke carefully; They are a little devious! The whole key handling system reeks of legacy. The problem spots revolve around the fact that for KEY_TYPED events, the KeyEvent instance returns the typed character in the method getKeyChar(), while for KEY_PRESSED and KEY_RELEASED events, one needs to use the getKeyCode() (which returns a KeyEvent.VK_[key] constant). This also makes for interesting times when using the getKeyStroke methods - be sure to read the JavaDocs. In particular, both the methods getKeyStroke(int keyCode, int modifiers) and getKeyStroke(int keyCode, int modifiers, boolean onKeyRelease) return strokes for KEY_PRESSED and KEY_RELEASED (the latter if the boolean is true), meaning that there are no way to get a stroke for KEY_TYPED when using the key codes.

This binding system is the functionality used by mnemonics (picking a menu item from a selected menu by a key, typically this letter is underlined) and accelerators (picking some menu item without navigating the menu, e.g. "Ctrl-F" for File->Open). There is also a trick here for the UI (the Look and Feel): The UI have a separate parent Map that takes care of any Look'n'Feel specific key bindings, and makes it possible to change the look and feel without loosing the application specific bindings.

Here's the JavaDoc from KeyboardManager, a package private helper class for the key bindings system, which I found nicely summing up the keybindings system:

" The KeyboardManager class is used to help dispatch keyboard actions for the WHEN_IN_FOCUSED_WINDOW style actions. Actions with other conditions are handled directly in JComponent.

Here's a description of the symantics of how keyboard dispatching should work atleast as I understand it.


KeyEvents are dispatched to the focused component. The focus manager gets first crack at processing this event. If the focus manager doesn't want it, then the JComponent calls super.processKeyEvent() this allows listeners a chance to process the event.


If none of the listeners "consumes" the event then the keybindings get a shot. This is where things start to get interesting. First, KeyStokes defined with the WHEN_FOCUSED condition get a chance. If none of these want the event, then the component walks though it's parents looked for actions of type WHEN_ANCESTOR_OF_FOCUSED_COMPONENT.


If no one has taken it yet, then it winds up here. We then look for components registered for WHEN_IN_FOCUSED_WINDOW events and fire to them. Note that if none of those are found then we pass the event to the menubars and let them have a crack at it. They're handled differently.


Lastly, we check if we're looking at an internal frame. If we are and no one wanted the event then we move up to the InternalFrame's creator and see if anyone wants the event (and so on and so on).
"

Since this article has come to include a bunch of stack traces to illustrate things, I'll chuck in a couple more to show where the keybindings kick in the event processing. On a window with two buttons, I've bound F2 to JButton A "WHEN_FOCUSED", F3 to the containing JPanel "WHEN_ANCESTOR_OF_FOCUSED_COMPONENT", and finally F4 to the same JButton A "WHEN_IN_FOCUSED_WINDOW". Hitting key F2, F3 and F4 when the button A is focused "hits" on all keys, while if JButton B is focused, F2 doesn't fire, but F3 and F4 still does; F2 doesn't fire since it is not focused, F3 fires since it is bound to the ancestor JPanel of JButton B, while F4 fires since the window that JButton B resides in is focused.

Here's the stacktrace for F2, which is bound to the JButton A "WHEN_FOCUSED", and fires when JButton A has focus:

 Thread [AWT-EventQueue-0]
  com.example.ExampleAction.actionPerformed(...)
  javax.swing.SwingUtilities.notifyAction(SwingUtilities.java:1636)
  javax.swing.JComponent.processKeyBinding(JComponent.java:2849)
  javax.swing.JComponent.processKeyBindings(JComponent.java:2884)
      ^^ Checking own bindings
  javax.swing.JComponent.processKeyEvent(JComponent.java:2812)    <-- .. next trace starts here!
  java.awt.Component.processEvent(Component.java:5993)
  java.awt.Container.processEvent(Container.java:2041)
  java.awt.Component.dispatchEventImpl(Component.java:4583)
  java.awt.Container.dispatchEventImpl(Container.java:2099)
  java.awt.Component.dispatchEvent(Component.java:4413)
     ^^ This is a redispatch of a new KeyEvent, now on the JButton, while the old will be consumed.
  java.awt.KeyboardFocusManager.redispatchEvent(KeyboardFocusManager.java:1848)
     ^^ It has now found the target Component: The JButton
  java.awt.DefaultKeyboardFocusManager.dispatchKeyEvent(DefaultKeyboardFocusManager.java:704)
  java.awt.DefaultKeyboardFocusManager.preDispatchKeyEvent(DefaultKeyboardFocusManager.java:969)
  java.awt.DefaultKeyboardFocusManager.typeAheadAssertions(DefaultKeyboardFocusManager.java:841)
  java.awt.DefaultKeyboardFocusManager.dispatchEvent(DefaultKeyboardFocusManager.java:668)
     ^^ The retargeting of the KeyEvent begins, by the global KeyboardFocusManager
  java.awt.Component.dispatchEventImpl(Component.java:4455)
  java.awt.Container.dispatchEventImpl(Container.java:2099)
  java.awt.Window.dispatchEventImpl(Window.java:2475)
  java.awt.Component.dispatchEvent(Component.java:4413)
     ^^ The initial dispatch, on the Window that holds the JButton.
  java.awt.EventQueue.dispatchEvent(EventQueue.java:599)
     ["EDT pump"]

Here's the stacktrace for F3, which is bound to the JPanel "WHEN_ANCESTOR_OF_FOCUSED_COMPONENT", and fires when either of the buttons (or anything else residing in that JPanel) has focus:

 Thread [AWT-EventQueue-0]
  com.example.ExampleAction.actionPerformed(...)
  javax.swing.SwingUtilities.notifyAction(SwingUtilities.java:1636)
  javax.swing.JComponent.processKeyBinding(JComponent.java:2849)
      ^^ This invocation is now on the JPanel and not the JButton anymore
  javax.swing.JComponent.processKeyBindings(JComponent.java:2895)
      ^^ Traversing parents
  javax.swing.JComponent.processKeyEvent(JComponent.java:2812)    <--
     -- same as above

And finally, here's the stacktrace for F4, which is bound to the JButton A "WHEN_IN_FOCUSED_WINDOW", and fires when either of the buttons (or anything else in the entire Window) has focus:

 Thread [AWT-EventQueue-0]
  com.example.ExampleAction.actionPerformed(...)
  javax.swing.SwingUtilities.notifyAction(SwingUtilities.java:1636)
  javax.swing.JComponent.processKeyBinding(JComponent.java:2849)
  javax.swing.KeyboardManager.fireBinding(KeyboardManager.java:267)
  javax.swing.KeyboardManager.fireKeyboardAction(KeyboardManager.java:216)
      ^^ Runs through all (showing) components that have registered WHEN_IN_FOCUSED_WINDOW maps.
  javax.swing.JComponent.processKeyBindingsForAllComponents(JComponent.java:2926)
      ^^ This is a static method, invoking the global KeyboardManager
  javax.swing.JComponent.processKeyBindings(JComponent.java:2918)
      ^^ Given up on local component bindings!
  javax.swing.JComponent.processKeyEvent(JComponent.java:2812)    <--
     -- same as above

It is worth noting that even if a key binding is bound to the InputMap WHEN_IN_FOCUSED_WINDOW for some component, the bound action will only fire if the component is showing and enabled. This means that if you have a JTabbedPane, adding a WHEN_IN_FOCUSED_WINDOW KeyBinding to some component on some tab, the action will only fire if this tab is the one showing - i.e. it won't fire if some other tab of that same JTabbedPane is showing. (The JTabbedPane alters the "visible" property of its contained components when changing tabs, which thus changes the showing property: Showing is when you are visible and all grandparents up to and including the window also are visible). This effect is probably what you want (!), but if not, then you'd obviously just do the key binding on the JTabbedPane instead, or even closer to the root Window.

Also, as could be read out of the JavaDoc rip above, if a component consumes the event, it will not percolate further, which most probably is what you'd want. This means that if the focus is on a JButton, and Space is pressed, this event will be consumed by the button to click it, and the event will not fire any of the WHEN_ANCESTOR_OF_FOCUSED_COMPONENT OR WHEN_IN_FOCUSED_WINDOW Actions bound further up in the hierarchy. Also, if a JTextField is focused, all KEY_TYPED events will be consumed in the same fashion, so that what one writes into the field won't also be processed by Actions higher up in the GUI hierarchy.

However, KEY_PRESSED or KEY_RELEASED events will still not be consumed in the manner described above - which when related to the deviousness of KeyStroke's static construction methods can become a little confusing! (As you probably understand by this, it has at least confused me: Java insisted on firing some key bindings I had added for no-modified characters on a component high up in the hierarchy (some JPanel), for example the key 'i' and 't' and so on, even though a text field way lower in the hierarchy was focused and happily processed what I typed - so that when I wrote some text in the field, for example "He liked it!", I also fired off the global actions!)

It is worth noticing that the older Keymap functionality found on JTextComponents was reimplemented using the InputMap/ActionMap functionality when that was introduced in Java 1.3.

Semantic event firing: To round this off, we'll just do a quick round of the high-level events, or the semantic events as they're also called. Swing is built upon the Model-View-Controller ("MVC") architecture pattern. The details here are way beyond the scope of this article, but I'll do a quick scratch nevertheless (go here for more). First of all, the pattern was apparently invented by a Norwegian (as is object oriented programming too). Now, with the essentials out of the way: Lets start with a button. The View would the physical/visual button as you see it, while the Model is the button's state ("focused", "armed", "pressed" and clicked or on/off), and the Controller is the logic that transitions the model through these states (getting pinged by the view when the user interacted with it).

For Swing, the View and Controller is collapsed into a UI Delegate ("UI"), which forms a part of the Look and Feel ("LaF") system of Swing. This new model is apparently "sometimes referred to" as a Separable Model Architecture. The rationale for this you'll have to pry out yourself from the above-linked documentation - I've never quite understood it..!

You thus end up with three classes for a button: the JButton itself (which is an AbstractButton, which is a JComponent, which is a Component), which has a UI delegate of type ButtonUI, and has a model of type ButtonModel. There is no standard ButtonUI, as this is a part of the installed LaF, but there is a "place to start" called BasicButtonUI. The standard ButtonModel is DefaultButtonModel.

  • You instantiate a JButton. Since it is a JComponent and thus a Component, it can have all the low-level AWTEvents fired on it, if it wants.

  • The JButton constructor instantiates and sets a DefaultButtonModel, and then (effectively) invokes updateUI, which installs the current LnF-dictated ButtonUI.

  • While setting the model, the JButton also installs a bunch of listeners on it. This is so that changes on the model may be reflected physically on the screen by the JButton: If the model becomes pressed, the JButton needs to know so that it can repaint itself into a pressed-looking state.

  • Assuming that we're doing BasicUI (which is Okay, WindowsButtonUI extends BasicButtonUI), the UI installs a slew of listeners on the JButton (which, as mentioned, can have all low-level AWT events delivered to it). It does this by instantiating a BasicButtonListener (a helper for the BasicButtonUI) which implement all these listeners, and then installs this instance by invoking the different add*Listener(instance) methods on the JButton.

  • The BasicButtonListener obviously implements MouseListener.mousePressed and mouseReleased. On pressed, the BasicButtonListener, i.e. the UI delegate updates the model to be armed and pressed, and it furthermore requests focus to the button. ...

  • ... while on release, the BasicButtonListener, i.e. the UI delegate updates the model to be un-pressed.

  • Since the button was armed, this update to un-pressed state makes the model create and fire the ActionEvent!

  • (The BasicButtonListener (i.e. the UI delegate) then also un-arms the model, making it ready for a new round)

As a little side-note, if you press the mouse on the JButton, but then drag the mouse out of the JButton while still holding the mouse button, the hooking of an AWTEventListener in the Container to catch mouse dragged events, (as mentioned above on retargeting of MouseEvents) will make sure that the button is still focused and pressed, BUT the still-fired mouseExit event will make the DefaultMouseListener (i.e. the UI delegate) un-arm the model. So, if you now release the mouse button outside of the JButton, it will not fire.

Anyways, here's a stack trace for a clicked JButton having an ActionListener installed. I've included the AWT Events preceeding this ActionListener invocation:

52729 [AWT-EventQueue-0] AWTEvent: @856d3b java.awt.event.MouseEvent[MOUSE_PRESSED,(57,15),absolute(-305,317),button=1,modifiers=Button1,extModifiers=Button1,clickCount=1] on JButton
53995 [AWT-EventQueue-0] AWTEvent: @681db8 java.awt.event.MouseEvent[MOUSE_RELEASED,(57,15),absolute(-305,317),button=1,modifiers=Button1,clickCount=1] on JButton
53995 [AWT-EventQueue-0] java.awt.event.ActionEvent[ACTION_PERFORMED,cmd=Button with AL,when=1236222620558,modifiers=Button1] on JButton
  com.example.ExampleActionListener.actionPerformed(...)
  javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:1995)
  javax.swing.AbstractButton$Handler.actionPerformed(AbstractButton.java:2318)
  javax.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel.java:387)
     ^^ Here we're processing the newly created semantic/high-level ActionEvent
  javax.swing.DefaultButtonModel.setPressed(DefaultButtonModel.java:242)
     ^^ This invocation is setPressed(false), which, since the model was "pressed" and "armed", creates and fires the ActionEvent.
  javax.swing.plaf.basic.BasicButtonListener.mouseReleased(BasicButtonListener.java:236)
  java.awt.Component.processMouseEvent(Component.java:6216)
  javax.swing.JComponent.processMouseEvent(JComponent.java:3265)
  java.awt.Component.processEvent(Component.java:5981)
  java.awt.Container.processEvent(Container.java:2041)
  java.awt.Component.dispatchEventImpl(Component.java:4583)
  java.awt.Container.dispatchEventImpl(Container.java:2099)
  java.awt.Component.dispatchEvent(Component.java:4413)
     ^^ Here we're processing the newly created retargeted AWTEvent, on the JButton instance
  java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4556)
  java.awt.LightweightDispatcher.processMouseEvent(Container.java:4220)
  java.awt.LightweightDispatcher.dispatchEvent(Container.java:4150)
     ^^ Invocation of retargeting through LightweightDispatcher
  java.awt.Container.dispatchEventImpl(Container.java:2085)
  java.awt.Window.dispatchEventImpl(Window.java:2475)
  java.awt.Component.dispatchEvent(Component.java:4413)
     ^^ Here we're processing the low-level AWTEvent straight from the operating system, on the Window instance
  java.awt.EventQueue.dispatchEvent(EventQueue.java:599)
     ["EDT pump"]

And with that, we're done!

216 comments:

  1. Hi, Endre - I just started some swing programming with my only clientside GUI experience being SWT. THIS IS A GREAT ARTICLE! It explains what is actually happening rather than telling you about a bunch of interfaces and how you add listeners.
    "MouseEvents goes to the most specific ("deepest") child component residing under the mouse, while KeyEvents are sent to the focused window, routed using the KeyboardFocusManager to the focused component in this window." is just such a simple AND significant statement if someone is doing a relatively complex GUI. THANKS!
    Ray Case

    ReplyDelete
  2. Endre, Thanks. This is very helpful information. Please keep this web site up! -Pete

    ReplyDelete
  3. Many Thanks Endre for this article! I am rewriting my Swing application into GWT with the intent to have both code bases kept together with as much of the code shared (controller logic) between those two "view" implementation. So far I've found that it's super difficult (if at all possible) to decouple a Swing application in the MVC (or MVP). I'm not going to describe the details here as I have not settled on a solution yet.

    I found your article looking for a Swing implementation of GWT's HandlerManager. This is a very useful class that allows you to decouple some of the code buried deep in your application's presenters/ views that implement an action that needs to happen as a reaction to an event. It would be nice to have an "event dispatcher" that handles custom "application level events". Check both parts of MVP tutorial on the GWT official doc.

    I've learned here that internals of Swing L&F are implemented in a completely different way to the current JavaScript (browser sourced event model). We are in desperate need for Swing 2.0 (not Java FX) as the code shows how messy the current one is.

    One point I want to make is for the future. Currently, the RIA apps we write are relatively small and immature. The fact that they depend on the Browser's event (native) implementation working correctly makes me worried. At some point I'd like to be able to see a stacktrace that originates inside the browser.

    ReplyDelete
  4. I cant resist myself to thank you. Thanks very much..you've done quite a research..very informative.

    ReplyDelete
  5. cong ty thiet ke webHTSolution là một công ty thiết kế website chuyên nghiệp cà chất lượng nhất, chúng tôi luôn đem đến cho các bạn những sản phẩm chất lượng và uy tiến hàng đầu thiết kế website chuẩn seo giá rẻTư vấn từ khóa hiệu quả, nhắm đúng khách hàng mục tiêu, theo dõi đấu giá từ khóa, tăng điểm chất lượng quảng cáo Google tối ưu chi phí tốt nhất. thiết kế web truyền thông thiết kế website trường họcThay đổi giao diện phù hợp với các dịp lễ, tết (Thanh toán theo từng dịp cụ thể và yêu cầu của khách hàng) thiết kế website chuyên nghiệpXây dựng cơ sở dữ liệu dựa trên ý tưởng thiết kế nơi nào thiết kế website giá rẻ Đưa ra cho quý khách những lựa chọn gói website và hosting tương ứng. Để Đáp ứng đủ nhu cầu của khách hàng, không gây sự lãng phí cũng như thiếu hụt tài nguyên website. thiết kế website chuyển phát nhanh | thiet ke website cong trinh xay dung
    phần mềm quản lý nhà hàngbạn đang bế tắc trong vấn đề quản lý của mình.? phan mem quan ly nha hang gia rephần mềm mà chúng tôi mang đến cam kết chất lượng và chuyên nghiệp phần mềm quản lý quán cafebạn ko biết mua phần mềm quản lý ở đâu giá rẻ mà chất lượng.? thiet ke web phong kham nha khoaVới việc thiết kế các thông tin trên website của bạn hướng tới lợi ích của khách hàng điều đó giúp khách hàng sẽ dễ dàng khai thác các thông tin trên website của Bạn Với hàng ngàn người lượt truy cập Internet thường xuyên, công ty, doanh nghiệp bạn sẽ nhanh chóng được biết đến, khách hàng có thể truy cập thông tin về doanh nghiệp

    ReplyDelete
  6. Great thoughts you got there, believe I may possibly try just some of it throughout my daily life.
    python training in chennai
    python course institute in chennai

    ReplyDelete



  7. Nice Article… I love to read your articles because your writing style is too good, its is very very helpful for all of us and I never get bored while reading your article because, they are becomes a more and more interesting from the starting lines until the end.

    Check out : big data training in velachery
    big data hadoop training cost in chennai
    big data training in chennai omr
    big data training in chennai velachery

    ReplyDelete
  8. This comment has been removed by the author.

    ReplyDelete
  9. Just saying thanks will not just be sufficient, for the fantastic lucidity in your writing amazon web services training. I will instantly grab your rss feed to stay informed of any updates.

    ReplyDelete
  10. On the off chance that an ASHP isn't the right answer for your home there are a few choices for you to give heating, boiling water, produce power, gain an extra pay or to turn out to be all the more ecologically agreeable.Warmtepomp

    ReplyDelete
  11. Its help me to improve my knowledge and skills also.im really satisfied in this AWS session.aws training in bangalore

    ReplyDelete
  12. Additionally any congested trees or bushes can contrarily influence the productivity of your framework and can likewise cause harm .airconditioning

    ReplyDelete
  13. Great post I would like to thank you for the efforts you have made in writing this interesting and knowledgeable article. best navigation apps

    ReplyDelete
  14. You would unquestionably need to discover a great vitality saver heat siphon water warmer. In the event that you buy a vitality saver warmer, this by itself will spare you a few hundred dollars per year. Warmtepompen

    ReplyDelete
  15. Do you burn through a large number of pounds each winter on LPG, oil or electric for heating? lucht warmtepomp

    ReplyDelete
  16. This is so elegant and logical and clearly explained. Brilliantly goes through what could be a complex process and makes it obvious.

    aws training bangalore
    aws tutorial for beginners

    ReplyDelete
  17. I have read your blog its very attractive and impressive. Very systematic indeed! Excellent work!
    Data Science Course
    Data Science Course in Marathahalli

    ReplyDelete
  18. Hi, I do think this is an excellent web site. I stumbledupon it ;) I may return once again since I bookmarked it. Money and freedom is the get greatest way to change, may you be rich and continue to guide other people.

    ReplyDelete
  19. Lake - Lake based heat pumps are not regularly utilized because of the should be near an outer wellspring of water.Warmtepomp

    ReplyDelete
  20. Android became the most popular mobile OS. Android powers hundreds of millions of mobile devices in more than 190 countries around the world because of that more companies are working into android sector.thnks a lot guys.
    C and C++ Training Institute in chennai | C and C++ Training Institute in anna nagar | C and C++ Training Institute in omr | C and C++ Training Institute in porur | C and C++ Training Institute in tambaram | C and C++ Training Institute in velachery

    ReplyDelete
  21. Very informative blog and useful article thank you for sharing with us, keep posting learn more about aws with cloud computing
    Cognex Providing world-class training in AWS Certification Course.
    The most trustworthy AWS Training in Chennai. Cognex is focused on giving top quality training and development services, which would take you to the next level of performance in AWS.Click Here

    ReplyDelete
  22. I feel very grateful that I read this. It is very helpful and very informative and I really learned a lot from it.
    360DigiTMG data science course in indore

    ReplyDelete
  23. After reading this web site I am very satisfied simply because this site is providing comprehensive knowledge for you to audience.
    AWS training in chennai | AWS training in annanagar | AWS training in omr | AWS training in porur | AWS training in tambaram | AWS training in velachery

    ReplyDelete
  24. I just got to this amazing site not long ago. I was actually captured with the piece of resources you have got here. Big thumbs up for making such wonderful blog page! Data Analyst Course

    ReplyDelete
  25. This is an awesome post.Really very informative and creative contents. These concept is a good way to enhance the knowledge.I like it and help me to article very well.Thank you for this brief explanation and very nice information.Well, got a good knowledge.

    AWS training in Chennai

    AWS Online Training in Chennai

    AWS training in Bangalore

    AWS training in Hyderabad

    AWS training in Coimbatore

    AWS training



    AWS Training in Chennai | Certification | Online Courses

    ReplyDelete
  26. Cool stuff you have and you keep overhaul every one of us.

    Data Science Course

    ReplyDelete
  27. After reading your article I was amazed. I know that you explain it very well. And I hope that other readers will also experience how I feel after reading your article

    amazing post written ... It shows your effort and dedication. Thanks for share such a nice post.Java training in Chennai

    Java Online training in Chennai

    Java Course in Chennai

    Best JAVA Training Institutes in Chennai

    Java training in Bangalore

    Java training in Hyderabad

    Java Training in Coimbatore

    Java Training

    Java Online Training


    ReplyDelete
  28. Nice Article… I love to read your articles because your writing style is too good, its is very very helpful for all of us and I never get bored while reading your article because, they are becomes a more and more interesting from the starting lines until the end.
    web designing training in chennai

    web designing training in omr

    digital marketing training in chennai

    digital marketing training in omr

    rpa training in chennai

    rpa training in omr

    tally training in chennai

    tally training in omr

    ReplyDelete
  29. I like the helpful info you provide in your articles. I’ll bookmark your weblog and check again here regularly. I am quite sure I will learn much new stuff right here! Good luck for the next!

    Azure Training in Chennai

    Azure Training in Bangalore

    Azure Training in Hyderabad

    Azure Training in Pune

    Azure Training | microsoft azure certification | Azure Online Training Course

    Azure Online Training

    ReplyDelete
  30. Tutorial is just awesome..It is really helpful for a newbie like me.. I am a regular follower of your blog. Really very informative post you shared here. Kindly keep blogging.



    AWS Course in Chennai

    AWS Course in Bangalore

    AWS Course in Hyderabad

    AWS Course in Coimbatore

    AWS Course

    AWS Certification Course

    AWS Certification Training

    AWS Online Training

    AWS Training

    ReplyDelete
  31. decided then to find a way to learn how to get into digital. digital marketing course in hyderabad

    ReplyDelete
  32. Such a very useful article. Very interesting to read this article.I would like to thank you for the efforts you had made for writing this awesome article. about us

    ReplyDelete
  33. It’s very informative and you are obviously very knowledgeable in this area. You have opened my eyes to varying views on this topic with interesting and solid content.
    data science courses

    ReplyDelete
  34. I truly like only reading every one your web logs. Simply desired to in form you which you simply have persons such as me that love your own work out. Absolutely an extraordinary informative article. Hats off to you! The details which you have furnished is quite valuable. Learn best tableau course in bangalore

    ReplyDelete
  35. This comment has been removed by the author.

    ReplyDelete
  36. This post was really thinkable for me, please updates more information about this related blog. Visit Ogen Infosystem for quality web design and SEO Services in your budget.
    SEO Service in Delhi

    ReplyDelete
  37. Awesome blog filled with valuable information and found very knowledgeable thanks for sharing.
    typeerror nonetype object is not subscriptable

    ReplyDelete
  38. Behind Google's automatic search prediction, behind Facebook's Newsfeed recommendation, behind Amazon's suggested products, and behind almost every other thing on the internet, Data Science has become the greatest driving force. data science course syllabus

    ReplyDelete
  39. A good blog always comes-up with new and exciting information and while reading I have feel that this blog is really have all those quality that qualify a blog to be a one.
    Best Institutes For Digital Marketing in Hyderabad

    ReplyDelete
  40. very well explained. I would like to thank you for the efforts you had made for writing this awesome article. This article inspired me to read more. keep it up.
    Logistic Regression explained
    Correlation vs Covariance
    Simple Linear Regression
    data science interview questions
    KNN Algorithm
    Bag of Words Python

    ReplyDelete
  41. Really, this article is truly one of the best, information shared was valuable and resourceful thank you.
    Data Scientist Training in Hyderabad

    ReplyDelete
  42. This is my first time i visit here. I found so many entertaining stuff in your blog, especially its discussion. From the tons of comments on your articles, I guess I am not the only one having all the leisure here! Keep up the good work. I have been meaning to write something like this on my website and you have given me an idea.

    data science course in India

    ReplyDelete
  43. This is a really explainable very well and i got more information from your site.Very much useful for me to understand many concepts and helped me a lot.Best data science courses in hyerabad

    ReplyDelete
  44. Through this post, I realize that your great information in playing with all the pieces was exceptionally useful. I advise this is the primary spot where I discover issues I've been scanning for. You have a smart yet alluring method of composing.
    digital marketing course in delhi

    ReplyDelete
  45. This post is very simple to read and appreciate without leaving any details out. Great work!
    data science courses in aurangabada

    ReplyDelete
  46. Intelligence could be said as the necessary process to formulate information based on available information. That is the basic. If you can formulate a new information based on existing information, then you are intelligent. data science course in india

    ReplyDelete
  47. I was taking a gander at some of your posts on this site and I consider this site is truly informational! Keep setting up..
    Best Digital Marketing Institute in Hyderabad

    ReplyDelete
  48. Super site! I am Loving it!! Will return once more, Im taking your food additionally, Thanks. ExcelR Data Science Course In Pune

    ReplyDelete
  49. I like this post and there is obviously a lot to know about this. I think you made some good points in Features also i figure that they having a great time to peruse this post. They might take a decent site to make an information, thanks for sharing it to me Keep working, great job!
    Braces in Bangalore

    ReplyDelete


  50. I don't have the time at the moment to fully read your site but I have bookmarked it and also added your RSS feeds. I will be back in a day or two. thanks for a great site.

    Best Digital Marketing Institute in Hyderabad

    ReplyDelete
  51. Hello there to everyone, here everybody is sharing such information, so it's fussy to see this webpage, and I used to visit this blog day by day
    data science training in noida

    ReplyDelete
  52. Thank you for excellent article.You made an article that is interesting.
    data science training in noida

    ReplyDelete
  53. Happy to chat on your blog, I feel like I can't wait to read more reliable posts and think we all want to thank many blog posts to share with us.

    Data Science Institutes in Bangalore

    ReplyDelete
  54. Excellent blog. Thank you for the updates and information. Share more

    IELTS Coaching in Chennai

    ReplyDelete

  55. It's really nice and meaningful. it's a really cool blog. Linking is a very useful thing.you have really helped lots of people who visit blogs and provide them useful information.

    business analytics course

    ReplyDelete
  56. Wonderful blog with great piece of information. Regards to your effort. Keep sharing more such blogs.Looking forward to learn more from you. Primavera Training in Chennai | Primavera online course

    ReplyDelete
  57. Thanks for the great post on your blog, it really gives me an insight on this topic.I must thank you for this informative ideas. I hope you will post again soon...
    Primavera Training in Chennai | Primavera online course

    ReplyDelete
  58. If you are looking for Illinois license plate sticker renewals online, you have to go to the right place. We have the fastest Illinois license plate sticker renewals in the state.

    Data Science Certification in Bangalore

    ReplyDelete
  59. Happy to chat on your blog, I feel like I can't wait to read more reliable posts and think we all want to thank many blog posts to share with us.

    Data Analytics Courses in Bangalore

    ReplyDelete
  60. Very good message. I stumbled across your blog and wanted to say that I really enjoyed reading your articles. Anyway, I will subscribe to your feed and hope you post again soon.

    Data Science In Bangalore

    ReplyDelete
  61. Wow, incredible weblog layout! How long have you ever been running a blog for? you made running a blog glance easy. The full look of your website is excellent, as well as the contentcustom boxes uk custom boxes uk

    ReplyDelete

  62. Very awesome!!! When I searched for this I found this website at the top of all blogs in search engines.

    Digital Marketing Training Institutes in Hyderabad

    ReplyDelete
  63. "I visited your blog you have shared amazing information, i really like the information provided by you, You have done a great work. I hope you will share some more information regarding full movies online. I appreciate your work.
    Thanks"

    Avet slips Beeren ondergoed dames

    ReplyDelete
  64. Excellence blog! Thanks For Sharing, The information provided by you is really a worthy. I read this blog and I got the more information about
    data scientist certification malaysia

    ReplyDelete
  65. I want to leave a little comment to support and wish you the best of luck.we wish you the best of luck in all your blogging enedevors.
    data analytics courses in bangalore

    ReplyDelete
  66. The AWS certification course has become the need of the hour for freshers, IT professionals, or young entrepreneurs. AWS is one of the largest global cloud platforms that aids in hosting and managing company services on the internet. It was conceived in the year 2006 to service the clients in the best way possible by offering customized IT infrastructure. Due to its robustness, Digital Nest added AWS training in Hyderabad under the umbrella of other courses

    ReplyDelete
  67. I like your post very much. It is very much useful for my research. I hope you to share more info about this. Keep posting



    ReplyDelete
  68. The information you have posted is very useful. The sites you have referred to were good. Thanks for sharing.
    data scientist training and placement in hyderabad

    ReplyDelete
  69. I have expressed a few of the articles on your website now, and I really like your style of blogging. I added it to my favorite’s blog site list and will be checking back soon…

    best data science institute in hyderabad

    ReplyDelete
  70. This is an excellent post . thanks for sharing it. It is really what I wanted to see. I hope in the future you will continue to share such an excellent post.

    business analytics course

    ReplyDelete
  71. This is most informative and also this post most user friendly and super navigation to all posts... Thank you so much for giving this information to me..
    machine learning certification in aurangabad

    ReplyDelete
  72. I am reading your post from the beginning, it was so interesting to read & I feel thanks to you for posting such a good blog, keep updates regularly.I want to share about
    best data science course online

    ReplyDelete
  73. The information you have posted is important. The objections you have insinuated was worthy. Thankful for sharing.
    machine learning training in aurangabad

    ReplyDelete
  74. Please can you translate the post in hindi? as i am weak in english. You can do it from English to hindi typing Converter

    ReplyDelete
  75. Your content is very unique and understandable useful for the readers keep update more article like this.
    data scientist course in pune

    ReplyDelete
  76. Your content is very unique and understandable useful for the readers keep update more article like this.
    data science course aurangabad

    ReplyDelete
  77. Fascinating post. I Have Been considering about this issue, so thankful for posting. Totally cool post.It 's very generally very Useful post.Thanks
    ai course in pune

    ReplyDelete
  78. Thanks for sharing this information. I really like your blog post very much. You have really shared a informative and interesting blog post with people..
    artificial intelligence course in pune

    ReplyDelete
  79. Always so interesting to visit your site.What a great info, thank you for sharing. this will help me so much in my learning
    artificial intelligence course in pune

    ReplyDelete
  80. I see some amazingly important and kept up to length of your strength searching for in your on the site
    Best Data Science courses in Hyderabad


    ReplyDelete
  81. This is a great post. I like this topic.This site has lots of advantage.I found many interesting things from this site. It helps me in many ways.Thanks for posting this again.
    data scientist training and placement

    ReplyDelete
  82. You are so interesting! I do not suppose I’ve read through anything like this before. So good to discover another person with a few genuine thoughts on this topic. Seriously. thank you for starting this up.

    Data Science Training in Hyderabad

    ReplyDelete
  83. You have completed certain reliable points there. I did some research on the subject and found that almost everyone will agree with your blog.
    Digital Marketing Course in Bangalore

    ReplyDelete
  84. Very nice job... Thanks for sharing this amazing and educative blog post!
    data scientist course

    ReplyDelete
  85. Phenomenal post! The methodology you have posted on this innovation assisted me with getting into a higher level and had part of Information…

    Data Science Training in Hyderabad

    ReplyDelete
  86. Your product is so nice. I love to hear about this topic more. And I will recommend this to my family and friends. Please update your blog post with more information and with other products also.lockable makeup box | lockable makeup box

    ReplyDelete
  87. It is perfect time to make some plans for the future and it is time to be happy. I've read this post and if I could I desire to suggest you some interesting things or suggestions. Perhaps you could write next articles referring to this article. I want to read more things about it!
    data scientist training and placement

    ReplyDelete
  88. This post is very simple to read and appreciate without leaving any details out. Great work!
    data science course aurangabad

    ReplyDelete
  89. Attackers know how to read the body language of bodyguards, and will easily tell if a bodyguard is not up to the task. This means that a bodyguard with no self-confidence exposes his/her bodyguard company
    client to attacks. A self-confident bodyguard deters potential attackers and wards them off from the person they are protecting. The factual actions by bodyguards comprise only 20% of their work, the remaining 80% is about thinking ahead and prevention. That's why adequate training is necessary for security officers.

    ReplyDelete
  90. I am browsing this website daily, and get good facts from here all the time.... E Visa of Turkey for the convenience of foreign travelers and tourists, Turkish government introduced an electronic visa processing. Here you can read all the details about Turkey visa eligibility rules, visa exemption guidelines, passenger locator form & visa fees. Visit Turkey evisa portal.

    ReplyDelete
  91. What a really awesome post this is. Truly, one of the best posts I've ever witnessed to see in my whole life. Wow, just keep it up.
    data science training

    ReplyDelete
  92. Very useful post. This is my first time i visit here. I found so many interesting stuff in your blog especially its discussion. Really its great article. Keep it up.
    data science online training in hyderabad

    ReplyDelete
  93. Really nice and interesting post. I was looking for this kind of information and enjoyed reading this one. Keep posting. Thanks for sharing. ethical hacking institute in delhi

    ReplyDelete
  94. I looked at most of your posts. This article is probably where I got the most useful information for my research. Thanks for posting, we can find out more about this. Do you know of any other websites on this topic?
    IoT Course

    ReplyDelete
  95. Very wonderful informative article. I appreciated looking at your article. Very wonderful reveal. I would like to twit this on my followers. Many thanks! .
    <a href="https://360digitmg.com/india/data-analytics-certification-training-course-in-bangalore>Data Analytics training in Bangalore</a>

    ReplyDelete
  96. I can see that you are an expert at your field! I am launching a website soon, and your information will be very useful for me.. Thanks for all your help and wishing you all the success in your business.
    data science institutes in hyderabad

    ReplyDelete
  97. I would like to thank you for the efforts you have made in writing this article. I am hoping for the same best work from you in the future as well..
    best digital marketing training in hyderabad

    ReplyDelete
  98. Hi to everybody, here everyone is sharing such knowledge, so it’s fastidious to see this site, and I used to visit this blog daily cloud computing training in noida

    ReplyDelete
  99. I feel very grateful that I read this. It is very helpful and very informative and I really learned a lot from it.ethical hacking training in noida

    ReplyDelete
  100. I must admit that your post is really interesting. I have spent a lot of my spare time reading your content. Thank you a lot! data science training in noida

    ReplyDelete
  101. This is very fascinating, You are an excessively skilled blogger. I’ve joined your feed and sit up for seeking extra of your magnificent post. Additionally, I’ve shared your site in my social networks data science training institute in gurgaon

    ReplyDelete
  102. I will truly value the essayist's decision for picking this magnificent article fitting to my matter.Here is profound depiction about the article matter which helped me more. business analytics course in surat

    ReplyDelete
  103. cool stuff you have and you keep overhaul every one of us data analytics course in mysore

    ReplyDelete
  104. Wow what a Great Information about World Day its exceptionally pleasant educational post. a debt of gratitude is in order for the post. data scientist course in mysore

    ReplyDelete
  105. It's a smart blog. I mean it seriously. You have so much knowledge on this subject and so much passion. He also knows how to get people to join him, obviously from the answers.

    Data Analytics Course in Nagpur

    ReplyDelete
  106. Excellent work done by you once again here. This is just the reason why I’ve always liked your work. You have amazing writing skills and you display them in every article. Keep it going! data science course in surat

    ReplyDelete
  107. https://360digitmg.com/india/data-analytics-course-in-jalandhar

    ReplyDelete
  108. Nice post! This is a very nice blog that I will definitively come back to more times this year! Thanks for informative post. business analytics course in mysore

    ReplyDelete
  109. Your music is amazing. You have some very talented artists. I wish you the best of success. data science training in kanpur

    ReplyDelete
  110. Through this post, I know that your good knowledge in playing with all the pieces was very helpful. I notify that this is the first place where I find issues I've been searching for. You have a clever yet attractive way of writing. data science course in mysore

    ReplyDelete
  111. If your looking for Online Illinois license plate sticker renewals then you have need to come to the right place.We offer the fastest Illinois license plate sticker renewals in the state. data scientist course in kanpur

    ReplyDelete
  112. Data Science Training in Nagpur

    Good blog and absolutely exceptional. You can do a lot better, but I still say it's perfect. Keep doing your best.

    Data Science Training in Nagpur

    ReplyDelete
  113. A good blog always comes-up with new and exciting information and while reading I feel that this blog really has all those qualities that qualify a blog to be one.
    data analytics course in hyderabad

    ReplyDelete
  114. This blog was really great, never seen a great blog like this before. i think im gonna share this to my friends..

    Data Scientist Training in Bangalore

    ReplyDelete
  115. Very Informative and useful... Keep it up the great work. I really appreciate your post.
    It shows like you spend more effort and time to write this blog

    https://bangaloredigitalmarketing.com/
    https://bangaloredigitalmarketing.com/digital-marketing-courses-in-bangalore/
    https://bangaloredigitalmarketing.com/seo-company-in-bangalore/
    https://bangaloredigitalmarketing.com/social-media-marketing-agency-in-bangalore/

    ReplyDelete
  116. Very informative message! There is so much information here that can help any business start a successful social media campaign!

    Data Science Training in Erode

    ReplyDelete
  117. Very informative message! There is so much information here that can help any business start a successful social media campaign!

    Business Analytics Course in Kolkata

    ReplyDelete
  118. Very informative message! There is so much information here that can help any business start a successful social media campaign!

    Data Scientist Course in Nashik

    ReplyDelete
  119. Unquestionably generally speaking very intriguing post. I was looking for such an information and totally savored the experience of examining this one. Keep on posting. A responsibility of appreciation is all together for sharing..data scientist course in bhopal

    ReplyDelete
  120. Must have contact details like your phone number, address, and date of birth. Your account will need to be verified at this point and if this isn’t possible, you’ll be asked to submit your ID documents the first time you join thereafter it becomes instantaneous with the ID then not being a requirement for future subsequent logins. http://www.e-vegas.com

    ReplyDelete
  121. SketchUp Pro Crack is generally a professional building software employed by hundreds of hundreds of business pros around the earth. The software concentrates on three-dimensional modeling for your broad assortment of drawings like within design and style and style, mechanical engineering, landscape sorts, architectural https://freeprosoftz.com/sketchup-pro-crack-free-download/

    ReplyDelete
  122. This post is very simple to read and appreciate without leaving any details out. Great work!
    data scientist training in hyderabad

    ReplyDelete
  123. The new wave of innovation that is changing the way people do business is called data science. Gain expertise in organizing, sorting, and transforming data to uncover hidden patterns Learn the essential skills of probability, statistics, and machine learning along with the techniques to break your data into a simpler format to derive meaningful information. Enroll in Data science in Bangalore and give yourself a chance to power your career to greater heights.
    Best Data Science Training in Bangalore

    ReplyDelete
  124. With the usage of AI tools, the developers can detect the customers' behavior about a particular website.
    data science training in ahmedabad

    ReplyDelete
  125. Data is generated by you, like the pages you search and the time you spend on particular sites.

    ReplyDelete
  126. The culprits can be identified even if they commit fraud of even a single penny.data science training in Durgapur

    ReplyDelete
  127. thank you for taking the duration to proclamation this find the maintain for an opinion totally beneficial!.... Inspirational Good Morning Sunday

    ReplyDelete

  128. We liked your content, I would like to contribute and share a few details about Digital Marketing training in hyderabad which is placement assured programDigital Marketing which helps you to get highly trained and make industry ready

    ReplyDelete
  129. Our Data Science certification training with a unique curriculum and methodology helps you to get placed in top-notch companies.
    data analytics course in gorakhpur

    ReplyDelete
  130. Many data science tools are deployed for data visualization to arrange the data so that the datasets related to each other are identified. So you have to build an understanding of the data science tools that can make you an expert in the field.

    ReplyDelete
  131. Digital Marketing Course in Delhi
    are an ideal way to further your career. You can get advice from experienced marketing professionals and establish your professional network as soon as you can. In fact, Digital Marketing Institute Digital Marketing course recently introduced a unique certification course for business leaders. It is designed to help improve your knowledge of marketing and boost the confidence to achieve your goals. Whether you are a senior marketer or rising star, this program is ideal for you. The program includes 12 classes and online modules, the program also features interactive Q&As along with support from a community of experts. It will provide all the information you need to make it. Presented by Raja Rajamannar, a senior market leader this program is open to senior marketing professionals, in addition to to professionals across all functions.

    ReplyDelete
  132. Nice Article Thanks for Sharing it was really helpful for me

    CMA institute Hyderabad

    ReplyDelete
  133. Unlock the power of cybersecurity with our top-notch training in Hyderabad. Join us to become a certified expert and protect the digital world from cyber threats. Stay ahead in this rapidly evolving field and secure a brighter future for yourself.

    Cyber Security Training in Hyderabad

    ReplyDelete
  134. This article provides a comprehensive overview of the data science process, from data collection to model deployment.data analyst course fees in chennai

    ReplyDelete
  135. Introducing Digitalguides, your trusted advisor for OTT streaming service. As an advisor, I'm here to help you resolve Disney plus error code 92. Try these fixes: clear cache, check internet connection, restart device, update the app, or reinstall Disney+. For further assistance, contact Disney+ support. Enjoy uninterrupted streaming with Disney+!

    ReplyDelete
  136. It may serve as a regional office to give passengers in the area customer service and information.I advise visiting their official website or getting in touch with their customer care if you want the most up-to-date and accurate information on IndiGO Airlines Vietnam Office presence in Vietnam and the services they provide.

    ReplyDelete
  137. "Your deep dive into AWT Swing event pumping and targeting is both insightful and impressive. It's clear that you've invested time and effort into understanding the inner workings of the event system. Your explanations about low-level events, the event pumping process, and the intricate dispatching mechanisms provide a valuable resource for developers seeking a comprehensive understanding of AWT/Swing. Thanks for sharing your knowledge and research in such a detailed and organized manner!"
    Data Analytics Courses In Bangalore

    ReplyDelete
  138. This is a thorough and helpful post! You've clearly put in a lot of time and effort to grasp Swing and AWT event handling. I like how you broke down the event flow and explained how different sorts of events are handled. It is admirable that you are prepared to identify any gaps in your understanding and seek corrections and recommendations. Continue to excel in your Swing learning experience!
    Data Analytics Courses in Delhi

    ReplyDelete
  139. Thanks for sharing this wonderful article. Unlock your full potential with our expert-led English tuition classes at Ziyyara Edutech. Our online English tuition offers personalized learning, interactive sessions, and comprehensive support.
    For more info visit English tuition classes

    ReplyDelete
  140. An insightful article shedding light on AWT Swing Event Pumping and Targeting, a crucial aspect of Java GUI programming, enhancing understanding and control over user interface events.

    Data Analytics Courses In Kochi



    ReplyDelete
  141. Thanks for the detailed explanation of the intended audience for this post. I'm a somewhat experienced developer who is interested in learning more about the inner workings of AWT/Swing, so this is definitely something I'll want to read.

    Data Analytics Courses In Bangalore

    ReplyDelete
  142. Akshi Engineers Pvt. Ltd. is leading Saudi Arabian Rolling Mill Manufacturers, innovating precision metal shaping solutions. Expertise in steel, aluminum, and specialty alloys. Committed to excellence in quality and efficiency for global industries.

    ReplyDelete
  143. Thanks for sharing this great article! That is very interesting I love reading and I am always searching for informative articles like this. Explore Ziyyara Edutech’s finest online tutoring sites for Class 12, offering expert guidance in physics alongside accountancy class 12 and other subjects.
    Book A Free Demo Today visit Online tutoring sites for class 12

    ReplyDelete
  144. A really interesting and lovely post. I appreciated reading this because I was searching for information of this nature. Continue to post. I appreciate you sharing.
    Data Analytics Courses in Agra



    ReplyDelete