This week's book giveaway is in the Mac OS forum. We're giving away four copies of a choice of "Take Control of Upgrading to Yosemite" or "Take Control of Automating Your Mac" and have Joe Kissell on-line! See this thread for details.
Originally posted by paritosh pandey: Is there is a way to restrict a jtable column to accept only date as input. and format it to a specific format?
The JTable pulls out data from the table model. JTable is just the view. It is bad usability to allow the user to edit in the table directly. Usually you present a dialog to the user, which he can use to edit single/multiple records. You can use a JFormatted text field or something similar to restrict and control the user input.
You can create customized renderers to display the date in the format of your choice or modify the getValueAt() method of your table model to return the correctly formatted string.
I beg to differ - I'd say it's good usability to allow the user to edit in the table directly - people like Excel, after all, I think they'd get annoyed if you had to do any editing in a dialogue.
I worked in a company previously where a PhD. Usability Expert was in charge of designing the UI. Like you I was of the same opinion. When I discussed this with him, his explanation was: "Whenever the user is going to change anything, which might possibly affect different things, it is always advisable to present the user with an edit dialog. This is a visual clue to the user, that he is doing something which is not in line with the generic work flow. Also, the table cells might not be displaying all the information. So a dialog with all the information properly presented is always preferred."
Of course usability is extremly subjective, and I do not intend at all to fire of any debate. Once upon a time I had come accross a usability article by Sun. It would be interesting to take a look at their view on this. I will try to hunt it out and post the link.
Joined: Jan 31, 2006
I see your point, Maneesh, and was really only being awkward I guess I'd say that this is an example of where academic theory differs from what people want (or think they want).
It would definitely be 'better', in Excel to show all the facts about the cell you're editing - for example, whether the value that you're seeing now is a constant, or the result of some other formula, in which case you probably don't want to just delete that value. BUT, try making an application that works like that - people will ask why it can't work the same as Excel...
Sorry, paritosh, I've hijacked your thread completely unnecessarily.