How can we set the bounds (example the indentation, position) of items present on Generic Dialog Box ImageJ?

Hey Folks ,

I have a list of items such as textboxes, drop-down list, text fields, image icons and many more things present in the Generic Box display screen. They are randomly arranged in the generic box with random indentation and alignment which looks quite odd as the final product. So, I want to arrange them in a manner so as the final product looks good. Kindly guide me to and give your suggestions and comments…

Appreciate your help, suggestions and time.

Hi @harsha09 ,

If you haven’t already, you should try the new imagej2 commands which also auto-generate a UI, and maybe you’ll be happier with what it produces.

It’s not easy. If the appearance of the ui is a high priority for you, I’d recommend writing the ui yourself and not using the GenericDialog. The downside is that you will then need to handle things like macro recording which GenericDialog does for you.

If you want to go with making the GenericDialog pretty, it would involve understanding / editing / subclassing the code. For example, changing the insets and layout for all of the fields you need to add.

I don’t know of a better way, and have not personally seen anyone tackle customizing a GenericDialog.

John

Hi John,

Thanks for providing me a detailed answer.