http://imagej.273.s1.nabble.com/GenericDialog-Choice-with-units-method-tp5023727p5023729.html
Indeed, and that is exactly what I have (= had) up to now (both for the NumericField as well as for the Choice)...
You could make the unit part of the choice string.
> Dear all,
> Within a GenericDialog there are 3 methods for adding a NumericField, one
> of them nicely giving the possibility to define the unit of the field
> content:
> void addNumericField(java.lang.String label, double
> defaultValue, int digits, int columns, java.lang.String units)
> Very unfortunately there is only one method for adding a Choice which
> actually doesn't give the option for an unit entry:
> addChoice(java.lang.String label, java.lang.String[]
> items, java.lang.String defaultItem)
> Thus following the addChoice method, I thought using a:
> addToSameRow()
> followed by a
> addMessage
> will be doing the job.
> Very unfortunately, in this case the added message correctly shows up on
> the same line than the choice but really really far away from the given
> Choice Component.
> As an alternative, I tryed then to use the following code:
> Component[] dlgItems =
> gd.getComponents();
> Component comp = dlgItems[6];
> GridBagLayout grid = (GridBagLayout)
> gd.getLayout();
> GridBagConstraints cst =
> grid.getConstraints(comp);
> cst.gridx = cst.gridx - 20;
> cst.gridy = cst.gridy - 1;
> grid.setConstraints(comp, cst);
> But as I'm able to modify the cst.gridy value as wished, this isn't the
> case for the cst.gridx one which seems to be kind of blocked.
> Thus is there a way to define an unit value just following a Choice
> Component?
> I thank you very much in advance for your lights on this and wish you a
> nice week-end.
> My best regards,
> Philippe
>
>
> Philippe CARL
> Laboratoire de Bioimagerie et Pathologies
> UMR 7021 CNRS - Université de Strasbourg
> Faculté de Pharmacie
> 74 route du Rhin
> <
https://www.google.com/maps/search/74+route+du+Rhin?entry=gmail&source=g>
> 67401 ILLKIRCH
> Tel : +33(0)3 68 85 42 89
>
> --
> ImageJ mailing list:
http://imagej.nih.gov/ij/list.html>