src/solaris/classes/sun/awt/X11/XTextFieldPeer.java

Print this page




  56 
  57 import sun.awt.CausedFocusEvent;
  58 import sun.awt.AWTAccessor;
  59 
  60 public class XTextFieldPeer extends XComponentPeer implements TextFieldPeer {
  61     private static final PlatformLogger log = PlatformLogger.getLogger("sun.awt.X11.XTextField");
  62 
  63     String text;
  64     XAWTTextField xtext;
  65 
  66     boolean firstChangeSkipped;
  67 
  68     public XTextFieldPeer(TextField target) {
  69         super(target);
  70         int start, end;
  71         firstChangeSkipped = false;
  72         text = target.getText();
  73         xtext = new XAWTTextField(text,this, target.getParent());
  74         xtext.getDocument().addDocumentListener(xtext);
  75         xtext.setCursor(target.getCursor());
  76         target.enableInputMethods(true);
  77         xtext.enableInputMethods(true);
  78         XToolkit.specialPeerMap.put(xtext,this);
  79 
  80         TextField txt = (TextField) target;
  81         initTextField();
  82         setText(txt.getText());
  83         if (txt.echoCharIsSet()) {
  84             setEchoChar(txt.getEchoChar());
  85         }
  86         else setEchoChar((char)0);
  87 
  88         start = txt.getSelectionStart();
  89         end = txt.getSelectionEnd();
  90 
  91         if (end > start) {
  92             select(start, end);
  93         }
  94         // Fix for 5100200
  95         // Restoring Motif behaviour
  96         // Since the end position of the selected text can be greater then the length of the text,
  97         // so we should set caret to max position of the text




  56 
  57 import sun.awt.CausedFocusEvent;
  58 import sun.awt.AWTAccessor;
  59 
  60 public class XTextFieldPeer extends XComponentPeer implements TextFieldPeer {
  61     private static final PlatformLogger log = PlatformLogger.getLogger("sun.awt.X11.XTextField");
  62 
  63     String text;
  64     XAWTTextField xtext;
  65 
  66     boolean firstChangeSkipped;
  67 
  68     public XTextFieldPeer(TextField target) {
  69         super(target);
  70         int start, end;
  71         firstChangeSkipped = false;
  72         text = target.getText();
  73         xtext = new XAWTTextField(text,this, target.getParent());
  74         xtext.getDocument().addDocumentListener(xtext);
  75         xtext.setCursor(target.getCursor());


  76         XToolkit.specialPeerMap.put(xtext,this);
  77 
  78         TextField txt = (TextField) target;
  79         initTextField();
  80         setText(txt.getText());
  81         if (txt.echoCharIsSet()) {
  82             setEchoChar(txt.getEchoChar());
  83         }
  84         else setEchoChar((char)0);
  85 
  86         start = txt.getSelectionStart();
  87         end = txt.getSelectionEnd();
  88 
  89         if (end > start) {
  90             select(start, end);
  91         }
  92         // Fix for 5100200
  93         // Restoring Motif behaviour
  94         // Since the end position of the selected text can be greater then the length of the text,
  95         // so we should set caret to max position of the text