This week's giveaways are in the MongoDB and Jobs Discussion forums.
We're giving away four copies of Mongo DB Applied Patterns and 4 resume reviews from Five Year Itch and have the authors/reps on-line!
See this thread and this one for details.
The moose likes Swing / AWT / SWT and the fly likes how would i keep client in textfield of jtable once error thrown Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


Win a copy of Mongo DB Applied Patterns this week in the MongoDB forum
or a resume review from Five Year Itch in the Jobs Discussion forum!
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Reply Bookmark "how would i keep client in textfield of jtable once error thrown" Watch "how would i keep client in textfield of jtable once error thrown" New topic
Author

how would i keep client in textfield of jtable once error thrown

john mattucci
Ranch Hand

Joined: Nov 03, 2000
Posts: 331
I have extended DefaultTableCellRenderer so that when a particular field in a column which is part of a JTable is filled with an invalid entry it turns red. I want this to happen so that the user is aware of their error. My next step which I want to do is to keep the user in that field. What would be the easiest way to go about keeping them in that field, without being able to enter into other fields??
Thanks for your time
Nathan Pruett
Bartender

Joined: Oct 18, 2000
Posts: 4121

Attach a FocusListener to the field that calls the validation code. If the validation passes, do nothing. If the validation fails, change the background color, and call requestFocus() on the field.


-Nate
Write once, run anywhere, because there's nowhere to hide! - /. A.C.
Paul Stevens
Ranch Hand

Joined: May 17, 2001
Posts: 2823
What happens if the user needs to look the information up somewhere else? They move the mouse to go check and you take them right back. Is this a user requirement?
john mattucci
Ranch Hand

Joined: Nov 03, 2000
Posts: 331
There is no need for them to move back. In the JTable i will have 2 columns one will contain a start date and the 2nd an end date. So im simply checking if the dates entered are correct
 
I agree. Here's the link: http://ej-technologies/jprofiler - if it wasn't for jprofiler, we would need to run our stuff on 16 servers instead of 3.
 
subject: how would i keep client in textfield of jtable once error thrown
 
Similar Threads
JTable
JTable
JTable
jtable
Ordering jtable