congrats Icon
New! Tabnine Pro 14-day free trial
Start a free trial
Tabnine Logo
InputMethodListener.getCaretPosition
Code IndexAdd Tabnine to your IDE (free)

How to use
getCaretPosition
method
in
org.microemu.device.InputMethodListener

Best Java code snippets using org.microemu.device.InputMethodListener.getCaretPosition (Showing top 5 results out of 315)

origin: org.microemu/microemu-javase

public void run() 
{
  while (!cancel) {
    try {
      resetKey = true;
      synchronized (this) {
        wait(1500);
      }
    } catch (InterruptedException ex) {
    }
    synchronized (this) {
      if (resetKey && lastButton != null && inputMethodListener != null) {
        int caret = inputMethodListener.getCaretPosition() + 1;
        if (caret <= inputMethodListener.getText().length()) {
          lastButton = null;
          lastButtonCharIndex = -1;
          InputMethodEvent event = new InputMethodEvent(InputMethodEvent.CARET_POSITION_CHANGED, caret, inputMethodListener.getText());
          inputMethodListener.caretPositionChanged(event);
        }
      }
    }
  }
}

origin: org.microemu/microemu-javase

protected void insertText(String str) {
  if (str.length() > 0) {
    int caret = inputMethodListener.getCaretPosition();
    String tmp = "";
    synchronized (this) {
      if (lastButton != null) {
        caret++;
        lastButton = null;
        lastButtonCharIndex = -1;
      }
      if (caret > 0) {
        tmp += inputMethodListener.getText().substring(0, caret);
      }
      tmp += str;
      if (caret < inputMethodListener.getText().length()) {
        tmp += inputMethodListener.getText().substring(caret);
      }
      caret += str.length();
    }
    if (!validate(tmp, inputMethodListener.getConstraints())) {
      return;
    }
    InputMethodEvent event = new InputMethodEvent(InputMethodEvent.INPUT_METHOD_TEXT_CHANGED, caret, tmp);
    inputMethodListener.inputMethodTextChanged(event);
    event = new InputMethodEvent(InputMethodEvent.CARET_POSITION_CHANGED, caret, tmp);
    inputMethodListener.caretPositionChanged(event);
  }
}
origin: org.microemu/microemu-javase-swt

SwtButton button = (SwtButton) e.nextElement();
if (ev.keyCode == button.getKeyCode()) {
  int caret = inputMethodListener.getCaretPosition();
  String tmp = inputMethodListener.getText();
  synchronized (this) {
origin: org.microemu/microemu-javase-swing

int caret = inputMethodListener.getCaretPosition();
origin: org.microemu/microemu-javase-swt

int caret = inputMethodListener.getCaretPosition();
org.microemu.deviceInputMethodListenergetCaretPosition

Popular methods of InputMethodListener

  • caretPositionChanged
  • getConstraints
  • getText
  • inputMethodTextChanged

Popular in Java

  • Creating JSON documents from java classes using gson
  • setRequestProperty (URLConnection)
  • findViewById (Activity)
  • getContentResolver (Context)
  • FileInputStream (java.io)
    An input stream that reads bytes from a file. File file = ...finally if (in != null) in.clos
  • URLEncoder (java.net)
    This class is used to encode a string using the format required by application/x-www-form-urlencoded
  • ResultSet (java.sql)
    An interface for an object which represents a database table entry, returned as the result of the qu
  • Dictionary (java.util)
    Note: Do not use this class since it is obsolete. Please use the Map interface for new implementatio
  • Executors (java.util.concurrent)
    Factory and utility methods for Executor, ExecutorService, ScheduledExecutorService, ThreadFactory,
  • SAXParseException (org.xml.sax)
    Encapsulate an XML parse error or warning.> This module, both source code and documentation, is in t
  • 21 Best Atom Packages for 2021
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimAtomGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyStudentsTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now