Re: Justify in dialog boxes
Posted by
Rasband, Wayne (NIH/NIMH) [E] on
Feb 16, 2011; 2:12am
URL: http://imagej.273.s1.nabble.com/Justify-in-dialog-boxes-tp3685680p3685686.html
On Feb 15, 2011, at 9:29 AM, Andrew Bell wrote:
> Dear List,
>
> I've written some straight forward macros that work fine. However there are several dialog boxes that are used, and it is really rather annoying that the text and any tick box/drop down menu etc are not justified in the dialog box. Here is an example:
>
> microscope = newArray("Old", "New");
> Dialog.create("Experiment Details");
> Dialog.addMessage("Please select which microscope was used.");
> Dialog.addChoice("Microscope:", microscope);
>
> Dialog.show();
>
> Here the choice box is left justified and the OK/Cancel buttons right justified. Or here:
>
> waitForUser("Click OK to continue");
>
> Is it possible to make them all center justified?
>
> Ridiculous question I know, but to me it's like fingernails down a blackboard!
You can't change the position of the "OK" and "Cancel" buttons but you can use the Dialog.setInsets(top,left,bottom) function to left justify the message and you can split it into two lines by adding a newline character ('\n'). The default insets (margins) for messages are 10, 20 and 0 pixels.
microscope = newArray("Old", "New");
Dialog.create("Details");
Dialog.setInsets(5, 0, 5);
Dialog.addMessage("Please select which\nmicroscope was used.");
Dialog.addChoice("Microscope:", microscope);
Dialog.show();