Sun Java Solaris Communities My SDN Account Join SDN
 
Code sample

Code Samples from the Java Developers Almanac 2000

 

Code Samples Index

These code examples and other materials are subject to Sun Microsystems, Inc. Legal Terms

Handling Focus Changes

 component.addFocusListener(new MyFocusListener());
     
 public class MyFocusListener extends FocusAdapter {
   public void focusGained(FocusEvent evt) {
     // The component gained the focus.
   }
   public void focusLost(FocusEvent evt) {
     // The component lost the focus.
   }
 }
 

Examplets provided by permission of the publisher, Addision-Wesley, and Author Patrick Chan.
Order this book from Amazon