Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Java > problem dispatching a key event in the new release i.e jdk1.5

Reply
Thread Tools

problem dispatching a key event in the new release i.e jdk1.5

 
 
umer
Guest
Posts: n/a
 
      05-04-2005
Hi this is my first post in this group, i just became a member.
The problem i'm having is, that i'm trying to dispatch a key event to a

textField that is a cell editor in a JTable, these things will make
more sense when i put my code snippet in the end. Anyways I generate a
key event and then dispatch it to the control i want to, and i've added

a keyListener to that control to track the events invoked, if i hit the

keys on the keyboard it shows me the debug message that <this> key was
pressed and so on. And it used to work fine on 1.4.2_04/05/07
any of the 1.4 release, but as soon as i downloaded and installed the
new release 1.5 it stopped workin'. If anybody can help me with this
its highly appreciated.


here's a snippet from my code where i'm generating a key event and
dispatching it.


//////////////////////////////*///////////////////////


int selRowNum = gbTable.getSelectedRow();
int selColNum = gbTable.getSelectedColumn();
if( selRowNum != - 1 && selColNum != - 1 )
{
DefaultCellEditor dce = (DefaultCellEditor)
gbTable.getCellEditor( selRowNum, selColNum );


if( e.getKeyCode() == KeyEvent.VK_TAB || e.getKeyCode() ==
KeyEvent.VK_UP || e.getKeyCode() == KeyEvent.VK_DOWN || e.getKeyCode()
== KeyEvent.VK_LEFT
|| e.getKeyCode() == KeyEvent.VK_RIGHT )
{
KeyEvent e1 = new KeyEvent( dce.getComponent(),
KeyEvent.KEY_PRESSED, System.currentTimeMillis(), 0, KeyEvent.VK_A, 'A'

);
dce.getComponent().dispatchEve*nt( e1 );


//////////////////////////////*//////////////////////////////*/


hope this makes sense
lemme know if u need any more info
again Thanx for your help !!

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Unexpected behaviour for dispatching events... Mark Java 4 01-12-2011 04:21 PM
dispatching click event to a link. it doesn't work. HopfZ Javascript 1 06-07-2007 04:30 PM
Exception occurred during event dispatching jobs239@hotmail.com Java 4 07-20-2005 09:19 AM
Replace Tab Key to Return Key (Enter Key) from Web Forms? M P ASP General 1 08-06-2004 08:32 AM



Advertisments