How to Write a Component Listener
by, 04-26-2012 at 08:26 PM (689 Views)
Component listener is considered as a listener interface to receive the component events. Component is that object which has a graphical presentation which might be displayed at screen or may also interact with some user. Few component examples are scrollbars, checkboxes and buttons of graphical interface.
Class involved in component event processing will be implementing this interface along with all of the contained methods or will be extending the abstract ComponentAdapter. Listener object that is made gets then registered by the method addComponentListener of the component. When visibility, size or location of the component changes, listener objectís relevant method is invoked
One or more than one component events have been fired, by component object, when component becomes hidden, moved, made visible or resized.
Component shown and component hidden events usually occur when Component 's setVisible method is called. For instance, window may get miniaturized to iconified, with no component hidden event, being fired.