1 19 20 package org.netbeans.modules.xml.core.lib; 21 22 import java.awt.event.FocusListener ; 23 24 29 public final class A11YUtil { 30 31 32 private A11YUtil() { 33 } 34 35 private static FocusListener flis; 36 37 41 public static synchronized FocusListener getA11YJTextFieldSupport() { 42 43 if (flis == null) { 44 flis = new java.awt.event.FocusListener () { 45 public void focusGained(java.awt.event.FocusEvent e) { 46 if (e.getComponent() instanceof javax.swing.JTextField ) { 47 ((javax.swing.JTextField )e.getComponent()).selectAll(); 48 } 49 } 50 public void focusLost(java.awt.event.FocusEvent e) { 51 if (e.getComponent() instanceof javax.swing.JTextField ) { 52 ((javax.swing.JTextField )e.getComponent()).select(1,1); 53 } 54 } 55 }; 56 } 57 return flis; 58 } 59 60 } 61 | Popular Tags |