Lenny,
I did it in the following way:
static DefaultEditorKit.CutAction cutAction = new
DefaultEditorKit.CutAction();
static DefaultEditorKit.CopyAction copyAction = new
DefaultEditorKit.CopyAction();
static CustomPasteAction pasteAction = new CustomPasteAction();
static final JTextComponent.KeyBinding[] defaultBindings = {
new JTextComponent.KeyBinding(
KeyStroke.getKeyStroke(KeyEvent.VK_C, InputEvent.CTRL_MASK),
DefaultEditorKit.copyAction),
new JTextComponent.KeyBinding(
KeyStroke.getKeyStroke(KeyEvent.VK_V, InputEvent.CTRL_MASK),
DefaultEditorKit.pasteAction),
new JTextComponent.KeyBinding(
KeyStroke.getKeyStroke(KeyEvent.VK_X, InputEvent.CTRL_MASK),
DefaultEditorKit.cutAction),
};
Hope it will be starting point for you.
Alexander.
"Reinstein, Lenny" wrote:
> Does anyone know if there's a way to intercept paste event in Swing? I.e.,
> if I am using not Swing's paste, but system's paste (Ctrl/C or the
> "Copy"/"Paste" menu in the browser), is there a way to intercept this event
> and do something with the text/String being pasted into a text component?
>
> I guess I can intercept documentChanged event in the component, but then I
> have to deal with all the content curently in the document.
>
> Thanks.
>
> -Lenny Reinstein, New York.
> _______________________________________________
> Advanced-swing mailing list
> [EMAIL PROTECTED]
> http://eos.dk/mailman/listinfo/advanced-swing
_______________________________________________
Advanced-swing mailing list
[EMAIL PROTECTED]
http://eos.dk/mailman/listinfo/advanced-swing