Package org.spoutcraft.api.gui

Examples of org.spoutcraft.api.gui.TextField


    boolean handled = false;
    if (Keyboard.getEventKey() == Keyboard.KEY_ESCAPE) {
      Keyboard.enableRepeatEvents(false);
    } else if (getScreen() != null) {
      boolean tab = Keyboard.getEventKey() == Keyboard.KEY_TAB;
      TextField focusedTF = null;
      ConcurrentSkipListMap<Integer, TextField> tabIndexMap = tab ? new ConcurrentSkipListMap<Integer, TextField>() : null;

      for (Widget widget : screen.getAttachedWidgets(true)) {
        if (widget instanceof Control) {
          Control control = (Control) widget;
          if (control.isFocus()) {
            if (Keyboard.getEventKeyState()) {
              handled = control.onKeyPressed(org.spoutcraft.api.gui.Keyboard.getKey(Keyboard.getEventKey()));
            } else {
              handled = control.onKeyReleased(org.spoutcraft.api.gui.Keyboard.getKey(Keyboard.getEventKey()));
            }
          }
          if (handled) {
            break;
          }
        }
        if (!Keyboard.getEventKeyState()) {
          break;
        }
        if (widget instanceof TextField) {
          TextField tf = (TextField) widget;
          // Handle tabbing get all textfields of this screen and start looking for the next bigger tab-index
          if (tab) {
            if (tf.isFocus()) {
              focusedTF = tf;
            }
            tabIndexMap.put(tf.getTabIndex(), tf);
          // Pass typed key to text processor
          } else if (tf.isEnabled() && tf.isFocus()) {
            if (tf.getTextProcessor().handleInput(Keyboard.getEventCharacter(), Keyboard.getEventKey())) {
              tf.onTextFieldChange();
              ScheduledTextFieldUpdate updateThread = null;
              if (scheduledTextFieldUpdates.containsKey(tf)) {
                updateThread = scheduledTextFieldUpdates.get(tf);
                if (updateThread.isAlive()) {
                  updateThread.delay();
View Full Code Here

TOP

Related Classes of org.spoutcraft.api.gui.TextField

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.