void OverrideKeyBindings() { Set<AWTKeyStroke> forTraSet = new HashSet<AWTKeyStroke>(); txt_box.setFocusTraversalKeys(KeyboardFocusManager.FORWARD_TRAVERSAL_KEYS, forTraSet); txt_box.setFocusTraversalKeys(KeyboardFocusManager.BACKWARD_TRAVERSAL_KEYS, forTraSet); GxwTextBox_overrideKeyCmd.noop_( (GfuiElem) host, txt_box, "control H"); // else ctrl+h deletes current char // GxwTextBox_overrideKeyCmd.new_(txt_box, "ENTER", Env_.NewLine); // else enter will always // use \n on window; jtextBox allows separation of \r from \n }
public void OverrideTabKey_(boolean v) { txt_box.OverrideTabKey_(v); if (v) { Set<AWTKeyStroke> forTraSet = new HashSet<AWTKeyStroke>(); txt_box.setFocusTraversalKeys(KeyboardFocusManager.FORWARD_TRAVERSAL_KEYS, forTraSet); txt_box.setFocusTraversalKeys(KeyboardFocusManager.BACKWARD_TRAVERSAL_KEYS, forTraSet); } else { Set<AWTKeyStroke> forTraSet = new HashSet<AWTKeyStroke>(); txt_box.setFocusTraversalKeys(KeyboardFocusManager.FORWARD_TRAVERSAL_KEYS, forTraSet); txt_box.setFocusTraversalKeys(KeyboardFocusManager.BACKWARD_TRAVERSAL_KEYS, forTraSet); GxwTextBox_overrideKeyCmd.focus_( (GfuiElem) host, txt_box, "TAB"); // else ctrl+h deletes current char GxwTextBox_overrideKeyCmd.focusPrv_( (GfuiElem) host, txt_box, "shift TAB"); // else ctrl+h deletes current char // Set<AWTKeyStroke> forTraSet = new HashSet<AWTKeyStroke> (); // forTraSet.add(AWTKeyStroke.getAWTKeyStroke("TAB")); // Set<AWTKeyStroke> bwdTraSet = new HashSet<AWTKeyStroke> (); // bwdTraSet.add(AWTKeyStroke.getAWTKeyStroke("control TAB")); // txt_box.setFocusTraversalKeys(KeyboardFocusManager.FORWARD_TRAVERSAL_KEYS, forTraSet); // txt_box.setFocusTraversalKeys(KeyboardFocusManager.BACKWARD_TRAVERSAL_KEYS, bwdTraSet); // txt_box.OverrideTabKey_(false); } }