1 31 32 package org.antlr.xjlib.appkit.text; 33 34 import org.antlr.xjlib.appkit.XJControl; 35 36 import javax.swing.*; 37 import java.awt.*; 38 import java.awt.event.FocusAdapter ; 39 import java.awt.event.FocusEvent ; 40 41 public class XJTextField extends XJControl { 42 43 private JTextField jTextField = null; 44 45 public XJTextField(String defaultString) { 46 jTextField = new JTextField(defaultString); 47 jTextField.addFocusListener(new FocusAdapter () { 48 public void focusGained(FocusEvent e) { 49 jTextField.selectAll(); 50 } 51 }); 52 } 53 54 public String getText() { 55 return jTextField.getText(); 56 } 57 58 public Component getJavaComponent() { 59 return jTextField; 60 } 61 } 62 | Popular Tags |