Logo Search packages:      
Sourcecode: yydebug version File versions  Download package

void jay::yydebug::yyJInputStream::keyPressed ( KeyEvent  ke  )  [inline]

this one ensures that you can only type at the end and implements control-C as copy and control-V as paste key if AWTPermission(accessClipboard) is granted. This is executed within the event thread.

BUG: paste should be based on the platform paste key; however, Safari does not send that one to an applet.

Definition at line 105 of file yyJInputStream.java.

References doKey().

    JTextArea ta = (JTextArea)ke.getComponent();
    int key = ke.getKeyCode();

    if (ke.isControlDown())
      try {
        switch (key) {
        case KeyEvent.VK_C: // ^C to copy
              .setContents(new StringSelection(ta.getSelectedText()), 
                 new ClipboardOwner() {
                   public void lostOwnership (Clipboard c, Transferable t) { }
        case KeyEvent.VK_V: // ^V to paste
          String string = (String)ta.getToolkit().getSystemClipboard()
          for (int n = 0; n < string.length(); ++ n)
            doKey(ta, string.charAt(n), true);
        default: // do not clear selection on control alone
          if (key < KeyEvent.VK_A || key > KeyEvent.VK_Z)
      } catch (Exception e) { } // no selection, no access to clipboard, etc.

      int pos = ta.getText().length();

Generated by  Doxygen 1.6.0   Back to index