Re: Alter dialog fields with DialogListener
Posted by
Michael Doube on
Apr 03, 2010; 3:23pm
URL: http://imagej.273.s1.nabble.com/Alter-dialog-fields-with-DialogListener-tp3688687p3688692.html
Michael,
>> For the units - hm, I fear that this will be more complicated. In
>> GenericDialog you can get no reference to the Label where the units
>> are displayed. You would have to iterate through the components of
>> the GenericDialog (gd.getComponents(), a method of the Container
>> class) and find the correct one (maybe it is the one after the
>> TextField that you want to modify, but I am not sure).
You have to iterate through all the Components, then get a reference to
each Panel Component, then get the Label from the Panel's 1st Component.
Then you get access to the Label's getText() and setText() methods. I
have written a method, replaceUnitString(), that does this.
http://github.com/mdoube/BoneJ/commit/6885d1b0489fed0811027401a04e737fbe26337cThanks again for your suggestions,
Michael