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 / April 2004

Tip: Looking for answers? Try searching our database.

JTable Problem - values not set when clicked on button

Thread view: 
Dave Oxtoby - 04 Apr 2004 13:27 GMT
Hi. I have a frame with a table in it and when the user enters values into
it they are able to save the table. However if the user doesn't press enter
to set the last cell of data, and clicks on the save button, the data in the
cell is not added to the table model as the system doesn't know it has been
entered. Is there any way of automatically finishing the editing of the cell
and setting the data it contains to the data model, perhaps by a lost focus
method, i.e. when the table loses focus the table finalises any cell being
edited adds its data to the model?

Any help will be most appreciated.
Dave Glasser - 04 Apr 2004 16:48 GMT
"Dave Oxtoby" <d.oxtoby@lineone.net> wrote on Sun, 4 Apr 2004 13:27:54
+0100 in comp.lang.java.gui:

>Hi. I have a frame with a table in it and when the user enters values into
>it they are able to save the table. However if the user doesn't press enter
[quoted text clipped - 4 lines]
>method, i.e. when the table loses focus the table finalises any cell being
>edited adds its data to the model?

In the event handler for your save button, try this, or some variation
of it:

if(table.isEditing()) {
   table.getCellEditor().stopCellEditing();
}

Signature

Check out QueryForm, a free, open source, Java/Swing-based
front end for relational databases.

http://qform.sourceforge.net



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.