Java JSP Application Hosting Web Hosting, website hosting, web site hosting , web page hosting Apache, PHP, MySQL, PERL, servlets Java, JSP  Java JSP Application Hosting Web Hosting website hosting, web site hosting, web page hosting Apache, PHP, MySQL, PERL, servlets Java, JSP,Python Java JSP Application Hosting Web Hosting website hosting, web site hosting, web page hosting Apache, PHP, MySQL, PERL, servlets Java, JSP,Python Java JSP Application Hosting Web Hosting website hosting, web site hosting, web page hosting Apache, PHP, MySQL, PERL, servlets Java, JSP,Python Java JSP Application Hosting Web Hosting website hosting, web site hosting, web page hosting, Apache, PHP, MySQL, PERL, servlets Java, JSP,Python
Java JSP Application Hosting Web Hosting, website hosting, web site hosting, web page hosting, Apache, PHP, MySQL, PERL, servlets Java, JSP, Python Java JSP Application Hosting Web Hosting, website hosting, web site hosting, web page hosting, Apache, PHP, MySQL, PERL, servlets Java, Python,JSP
Java JSP Application Hosting Web Hosting Sign-Up Java JSP Application Hosting Fund Raising, Fundraising, web hosting, website hosting, web site hosting  Java JSP Application Hosting Resellers web hosting, website hosting, web site hosting Java JSP Application Hosting EZ Site Control Panel for web hosting,website hosting, web site hosting
Java JSP Application Hosting Web Hosting, website hosting, web site hosting , web page hosting Apache, PHP, MySQL, PERL, servlets Java, Python,JSP,  Fundraising
Java JSP Application Hosting Fund Raising, Fundraising, web hosting, website hosting, web site hosting
WWW.

Call Us Toll-Free
(877) 256-0328

Outside USA
1 - (201) 505-0430

Java JSP Application Hosting Welcome Java JSP Application Hosting Web Hosting Plans Overview , Fund Raising, Fundraising, web hosting, website hosting, web site hosting Java JSP Application Hosting Fund Raising, Fundraising, web hosting Java JSP Application Hosting Resellers, web Hosting Java JSP Application Hosting Web Design, web Hosting Java JSP Application Hosting Extra Services,  web Hosting Java JSP Application Hosting Traffic Booster, web hosting Java JSP Application Hosting Traffic Booster, web hosting Java JSP Application Hosting Technical Support,  web Hosting Java JSP Application Hosting webmaster tips,  web Hosting Java JSP Application Hosting 30 Day Money Back, web hosting Java JSP Application Hosting Legal Notices for Web Hosting Java JSP Application Hosting Glossary Computer Terms for web Hosting Java JSP Application Hosting Contact Information - web hosting

Site Map
Java JSP Application Hosting Web Hosting, website hosting, web site hosting , web page hosting Apache, PHP, MySQL, PERL, servlets Java, Python, JSP Java JSP Application Hosting Java JSP Application Hosting Java JSP Application Hosting Java JSP Application Hosting Java JSP Application Hosting Listeners Supported by Swing Components (The Java™ Tutorials > Creating a GUI with JFC/Swing > Writing Event Listeners)
Trail: Creating a GUI with JFC/Swing
Lesson: Writing Event Listeners
Home Page > Creating a GUI with JFC/Swing > Writing Event Listeners
Listeners Supported by Swing Components
You can tell what kinds of events a component can fire by looking at the kinds of event listeners you can register on it. For example, the JComboBox class defines these listener registration methods:
  • addActionListener
  • addItemListener
  • addPopupMenuListener
Thus, a combo box supports action, item, and popup menu listeners in addition to the listener methods it inherits from JComponent.

Listeners supported by Swing components fall into two categories:

Listeners that All Swing Components Support

Because all Swing components descend from the AWT Component class, you can register the following listeners on any Swing component:
component listener
Listens for changes in the component's size, position, or visibility.
focus listener
Listens for whether the component gained or lost the keyboard focus.
key listener
Listens for key presses; key events are fired only by the component that has the current keyboard focus.
mouse listener
Listens for mouse clicks, mouse presses, mouse releases and mouse movement into or out of the component's drawing area.
mouse-motion listener
Listens for changes in the mouse cursor's position over the component.
mouse-wheel listener
Listens for mouse wheel movement over the component.
Hierarchy Listener
Listens for changes to a component's containment hierarchy of changed events.
Hierarchy Bounds Listener
Listens for changes to a component's containment hierarchy of moved and resized events.

All Swing components descend from the AWT Container class, but many of them are not used as containers. So, technically speaking, any Swing component can fire container events, which notify listeners that a component has been added to or removed from the container. Realistically speaking, however, only containers (such as panels and frames) and compound components (such as combo boxes) typically fire container events.

JComponent provides support for three more listener types. You can register an ancestor listener to be notified when a component's containment ancestors are added to or removed from a container, hidden, made visible, or moved. This listener type is an implementation detail which predated hierarchy listeners.

The other two listener types are part of the Swing components' conformance to the JavaBeansTM specification. Among other things, this means that Swing components support bound and constrained properties and notify listeners of changes to the properties. Property change listeners listen for changes to bound properties and are used by several Swing components, such as formatted text fields, to track changes on a component's bound properties. Also, property change listeners, as well as vetoable change listeners are used by builder tools to listen for changes on constrained properties. For more information refer to the Properties lesson in the JavaBeans trail.

Other Listeners that Swing Components Support

The following table lists Swing components and the specialized listeners they support, not including listeners supported by all Components, Containers, or JComponents. In many cases, the events are fired directly from the component. In other cases, the events are fired from the component's data or selection model. To find out the details for the particular component and listener you are interested in, go first to the component how-to section, and then if necessary to the listener how-to section.

This table lists Swing components with their specialized listeners
Component Listener
action caret change document,
undoable edit
item list
selection
window other
button

checked

 

checked

 

checked

     
check box

checked

 

checked

 

checked

     
color chooser    

checked

         
combo box

checked

     

checked

     
dialog            

checked

 
editor pane  

checked

 

checked

      hyperlink
file chooser

checked

             
formatted text field

checked

checked

 

checked

       
frame            

checked

 
internal frame               internal frame
list          

checked

  list data
menu               menu
menu item

checked

 

checked

 

checked

    menu key
menu drag mouse
option pane                
password field

checked

checked

 

checked

       
popup menu               popup menu
progress bar    

checked

         
radio button

checked

 

checked

 

checked

     
slider    

checked

         
spinner    

checked

         
tabbed pane    

checked

         
table          

checked

    table model
table column model
cell editor
text area  

checked

 

checked

       
text field

checked

checked

 

checked

       
text pane  

checked

 

checked

        hyperlink
toggle button

checked

 

checked

 

checked

     
tree                 tree expansion
tree will expand
tree model
tree selection
viewport
(used by scrollpane)
   

checked

         
Previous page: General Information about Writing Event Listeners
Next page: Implementing Listeners for Commonly Handled Events
 
 
 

Add to My Yahoo!

XML icon

Add to Google

 

 

 

 

 

 

 

 

 

 

 

JSP Servlets Tomcat mysql Java JSP Servlets Tomcat mysql Java JSP Servlets Tomcat mysql Java JSP Servlets Tomcat mysql Java JSP at JSP.aldenWEBhosting.com Servlets at servlets.aldenWEBhosting.com Tomcat at Tomcat.aldenWEBhosting.com mysql at mysql.aldenWEBhosting.com Java at Java.aldenWEBhosting.com Web Hosts Portal Web Links Web Links Web Hosting JSP Solutions Web Links JSP Solutions Web Hosting Servlets Solutions Web Links Servlets Solutions Web Hosting Web Links Web Links . . .
.
.
. .
.
. .
. . . . . . . . . . . jsp hosting servlets hosting web hosting web sites designed cheap web hosting web site hosting myspace web hosting