🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.lang.java.programmer
Article #446

keyevent

#446
From: 103430.2630
Date: Thu, 06 Nov 1997 00:00
32 lines
2447 bytes
I am trying to send a CTRL-Z to an textArea with the code below. The
textArea is not responding to this code by performing and undo (ctrl-z).
I want to be able to use the functions built into textArea and not
rewriting my own undo, cut, copy, paste, and select all methods. Any
ideas why the code below doesn't produce a ctrl-z key event when it is
passed a textArea?

public static void sendCTRLZ (Component target) {
���� EventQueue q = Toolkit.getDefaultToolkit().getSystemEventQueue();
���� KeyEvent k;�������
���� long time = new Date().getTime();
���k = new KeyEvent(target, KeyEvent.KEY_PRESSED, time, 2, 90, (char) 90);
 q.postEvent(k);
 }

If a popup menu is added to a textArea these options are automatically
added to the popup menu. I would like to call these options from a menubar
and not make the user use the popup menu if they don't want to.
-How does the popupmenu know to add these items when it is added
toatextArea?
-Can these menu items be called directly bypassing the need to send the
keyboard shortcuts to textArea?
thx
George Tome



103430.2630@compuserve.com

-------------------==== Posted via Deja News ====-----------------------
      http://www.dejanews.com/     Search, Read, Post to Usenet
Technical Details
Message-ID: <878870345.28929@dejanews.com>
Path: arc1-ca.pugleaf.net!unknown!not-for-mail

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII
X-Google-Thread: 10a146,6a32fcdd189bbbb4,start
X-Google-Attributes: gid10a146,public
X-Google-Thread: fdb77,6a32fcdd189bbbb4,start
X-Google-Attributes: gidfdb77,public
X-Google-Thread: 10fd6d,6a32fcdd189bbbb4,start
X-Google-Attributes: gid10fd6d,public
X-Google-Thread: 113ae9,6a32fcdd189bbbb4,start
X-Google-Attributes: gid113ae9,public
X-Google-Thread: f74b3,6a32fcdd189bbbb4,start
X-Google-Attributes: gidf74b3,public
X-Google-Thread: 10e3d3,6a32fcdd189bbbb4,start
X-Google-Attributes: gid10e3d3,public
From: 103430.2630@compuserve.com
Subject: keyevent
Date: 1997/11/06
Message-ID: <878870345.28929@dejanews.com>
X-Deja-AN: 287553011
X-Http-User-Agent: Mozilla/4.0 (compatible; MSIE 4.0; Windows 95)
X-Originating-IP-Addr: 153.35.105.122 (1Cust122.max14.chicago.il.ms.uu.net)
Organization: Deja News Posting Service
X-Authenticated-Sender: 103430.2630@compuserve.com
X-Article-Creation-Date: Fri Nov 07 02:39:05 1997 GMT
Newsgroups: comp.lang.java.programmer,borland.public.jbuilder.java.language,tw.bbs.comp.lang.java,comp.lang.java.gui,comp.lang.java.advocacy,comp.lang.java.help