|
From: Nick C. <sr...@ea...> - 2001-09-03 20:40:58
|
Hi, I just checked some code (uchicago/src/reflector/PropertyTextField.java) into cvs that will update a text field parameter whenever that field loses focus. It seems to work okay on Linux. I do have qualms however, and that's why I'm writing this. I've set PropertyTextField to send a message to the console whenever focus is lost and thus an update occurs, and you'll see that focus is lost for virtually any kind of key-stroke or mouse event. I'd rather not be calling methods on the model so often. The other thing I'm worried about is call sequence. That is, if the user changes a parameter and then clicks start at least two events are fired, one is the obvious button click on start, and the second is the loss of focus on the parameter text field. Some simple tests on linux show the the loss of focus event is handled first, and then the mouse click. Does anyone know if this order is guaranteed by the java spec? That is, loss of focus broadcast and handled prior to the click that cause the loss of focus. Obviously if its not guaranteed the whole thing goes out the window. I can look this up, but wanted to know if anyone knew offhand. So, thoughts, comment on setting parameters via focus adapters? thanks, Nick ps. I've included a sample model that has a few different kind of parameters. I've used to it test this new focus parameter setting. Its in a test package so you'll need to put in a test directory and compile it from there. n. -- Nick Collier Social Science Research Computing University of Chicago http://repast.sourceforge.net |