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 / November 2003

Tip: Looking for answers? Try searching our database.

edit jtable with enter

Thread view: 
ndario - 25 Nov 2003 14:26 GMT
i am having a problem with jtable which i was unable to solve for a
last couple a days. i think there needs to be much more docs on some
tricky uses of jtable than basic JTable/TableModel usage. so far i
managed to move to the next cell when i press enter (right  hand side,
instead of moving down).

i'd like to start editing in the next cell after moving from previous
cell. so, if i was in editing mode in some cell, enter should bring me
to the next cell with caret blinking in it. of course, if i wasn't
editing some cell i don't want to edit next cell.

basicly, i want to make "row edit session", for example user starts
editing a cell with f2, and as long as he press enter he edits next
cell, until he reaches the end of the row and then changes are
commited to database, just like M$Access and SQLserver does. i think i
can do this myself, all i need is little help to start edit next cell
if user moves from previous cell. i checked BasicTableUI source, and
as i see i should get the editor component and request focus on it.
but i am stuck with that.

thanks!
Kleopatra - 25 Nov 2003 16:21 GMT
> i am having a problem with jtable which i was unable to solve for a
> last couple a days. i think there needs to be much more docs on some
> tricky uses of jtable than basic JTable/TableModel usage. so far i
> managed to move to the next cell when i press enter (right  hand side,
> instead of moving down).

just wondering - how did you do it? I'm asking because if you do it the
swing way (manipulate inputMap/actionMap) then you are halfway through
with your other requirement ...

> i'd like to start editing in the next cell after moving from previous
> cell. so, if i was in editing mode in some cell, enter should bring me
> to the next cell with caret blinking in it. of course, if i wasn't
> editing some cell i don't want to edit next cell.

... wrap the appropriate navigational actions registered for the table
with custom actions that

a) check if the table is editing
b) call the original
c) start editing at the new cell if a) returned true.

and replace the original actions in the actionMap with your wrappers.

Greetings
Jeanette


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.