| 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
|
 |
 |
|
|
subject: how would i keep client in textfield of jtable once error thrown
|
|
|