Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / GUI / June 2005

Tip: Looking for answers? Try searching our database.

JTable and keyboard focus

Thread view: 
jbull@cs.sun.ac.za - 21 Jun 2005 09:44 GMT
Hi, I the following problem with a JCombobox editor in JTable.
I want the first keystroke in the JTable to be passed in the Editor of
the JCombobox. In JTable, the following code handles the keyboard
events:

if (editorComponent instanceof JComponent) {
  retValue = ((JComponent)editorComponent).processKeyBinding(ks, e,
              WHEN_FOCUSED, pressed);

  // If we have started an editor as a result of the user
  // pressing a key and the surrendersFocusOnKeystroke property
  // is true, give the focus to the new editor.
  if (getSurrendersFocusOnKeystroke()) {
     editorComponent.requestFocus();
  }
}

Shouldn't we first surrender the focus and then pass the keyboard
event?
I have to type a char twice before the editor of JCombobox receives it.
If this
is the intended behaviour of the JTable, can anyone tell me how to
resent the keyboard event to the JComboBox? Or am I missing the point
completely?

Thanks
Christian Kaufhold - 22 Jun 2005 10:49 GMT
> I want the first keystroke in the JTable to be passed in the Editor of
> the JCombobox. In JTable, the following code handles the keyboard
[quoted text clipped - 14 lines]
> Shouldn't we first surrender the focus and then pass the keyboard
> event?

It does not matter since focus requests may be handled asynchronously.

> I have to type a char twice before the editor of JCombobox receives it.
> If this
> is the intended behaviour of the JTable, can anyone tell me how to
> resent the keyboard event to the JComboBox? Or am I missing the point
> completely?

Please post a compilable example so I can play with it.

Christian


Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.