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 / January 2005

Tip: Looking for answers? Try searching our database.

switch to editor when renderer gets focus

Thread view: 
doubleought77@hotmail.com - 17 Dec 2004 17:19 GMT
I have a jcombobox as an editor inside a jtable.
I would like to switch to the editor as soon as they enter the column
with the jcombobox in it so they can start editing right away.
This is an editable jcombobox, so when tabbing through the columns in
the jtable, the first key stroke only activates the editor -- so the
second keystroke is being used instead of the first.

entering the column with the jcombobox in it, you have to hit the space
bar or the enter key before you can type in the jcombobox editor.
Otherwise, if you start typing "Smith" in the column, the "S" activates
the combobox editor and the list jumps to the "m" section instead of
the "s" section.

Appreciate the help. TIA
John McGrath - 19 Dec 2004 00:32 GMT
> entering the column with the jcombobox in it, you have to hit the space
> bar or the enter key before you can type in the jcombobox editor.
> Otherwise, if you start typing "Smith" in the column, the "S" activates
> the combobox editor and the list jumps to the "m" section instead of
> the "s" section.

Have you tried table.setSurrendersFocusOnKeystroke(true) ?

Signature

Regards,

John McGrath

doubleought77@hotmail.com - 20 Dec 2004 15:11 GMT
> Have you tried table.setSurrendersFocusOnKeystroke(true) ?
>
> --
> Regards,
>
> John McGrath

I use it all the time.  It is especially useful for changing the editor
to the renderer on columns that are no longer being edited.  However,
it has no effect for changing the renderer to the editor on columns
that have focus.

THX
doubleought77@hotmail.com - 24 Dec 2004 16:09 GMT
> > Have you tried table.setSurrendersFocusOnKeystroke(true) ?
> >
> > --
> > Regards,
> >
> > John McGrath

I played around enough until I found a solution.
Over-ride the columnSelectionChanged event and set the selected cell
into edit mode.  This will work when clicking on a cell or entering it
via TAB keys or arrows.

public void columnSelectionChanged(ListSelectionEvent e) {
super.columnSelectionChanged(e);
editCellAt(getSelectedRow(), getSelectedColumn());
   }
John McGrath - 04 Jan 2005 01:17 GMT
> I played around enough until I found a solution.
> Over-ride the columnSelectionChanged event and set the selected cell
> into edit mode.  This will work when clicking on a cell or entering it
> via TAB keys or arrows.

That sounds like it would only work when you change columns.  You could
move to a cell in the same column using up or down arrow key.

Signature

Regards,

John McGrath



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.