java - What happens if an event is not handled? -
i new java gui. if have button , there no event handler provided me ,then going handle event? related event dispatcher thread event handler? please explain role of event listener although have handler? event handling , exception handling work same way? regards
nobdy's gonna hear it. event mechanism in java swing (and other gui libs) listener (publish / subscribe) pattern. if no listner registered, no 1 handle event.
take @ this: http://www.programcreek.com/2009/01/the-steps-involved-in-building-a-swing-gui-application/. in general: publisher (e.g. jbutton) publishes many events: mouseclicks, hovers , on. arbitrary amount of subscribers (mouseadapter,...) may register. every time event of specific type published (e.g. mouseevent) right listner comes in place , it's action.
the publisher not know how many , subscribers registered. in way loosely coupled
Comments
Post a Comment