Last active
July 4, 2020 11:45
-
-
Save mutterer/0bdb047c6b7e3a5b82ced6e68e3187f8 to your computer and use it in GitHub Desktop.
example for using the new directory chooser field in generic dialogs in ImageJ
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import ij.*; | |
import ij.gui.*; | |
import ij.plugin.*; | |
// requires ImageJ 1.53d8 or later | |
public class My_DialogWithDirChooser implements PlugIn { | |
String dir; | |
public void run(String arg) { | |
dir = "empty"; | |
if (!showDialog()) return; | |
IJ.log("you chose: "+dir); | |
} | |
boolean showDialog() { | |
GenericDialog gd = new GenericDialog("Dialog with dir chooser"); | |
gd.addMessage("\u2606"+" Instructions here !"); | |
gd.addDirectoryField("dir chooser \u261E", IJ.getDirectory("home")); | |
gd.showDialog(); | |
if (gd.wasCanceled()) | |
return false; | |
dir = gd.getNextString(); | |
return true; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
removed the unicode char from label's first word as this is what gets recorded!
run("My DialogWithDirChooser", "dir=/Users/jeromemutterer/");