[messages] [Technical Support & Bugs] Re: Numeric characters truncated during editing

irishwulf irishwulf at gmail.com
Fri Jan 27 06:59:31 MST 2012


I think I have this reproducible, and I think I know why it happens. 
StringConfigurer fires a propertychangeevent on key release, which then
updates propertychangelisteners, (I think) including the actual source
attribute.  However, when I am making a lot of edits I am often typing
very fast - so say I am changing a marker 'Cost_1' with value '6' to
marker 'Cost_2' with value '5', I will backspace the '1', type '2', hit
TAB _immediately_, such that the key release is (I imagine) fired for
the TAB, and not the 2, and change the marker value.  Clicking 'OK'
probably only helps because it forces me to pause long enough in the
field for the key release event to fire appropriately and update the
propertychangelisteners.  So, to reproduce:
(1) Create a marker trait
(2) Start to type for the name of the marker 'MyProp_y'.  As quickly as
possible after hitting the 'y', tab to the next field.
(3) Reenter the marker, observe, hopefully, 'MyProp_'.

Supposedly the correct design for listening to changes to JTextFields is
by using either TextEvents or DocumentEvents, not KeyEvents.  Sorry it
took so long to come up with a reproducible pattern, but I hope that
helps.

Cheers,
Seth

_______________________________________________
Read this topic online here:
http://www.vassalengine.org/forum/viewtopic.php?p=30115#p30115


More information about the messages mailing list