private void enterInteractiveMode() { if (interactiveMode) return; String title = getTitle(); if (ta!=null && ta.getText().length()>400 && !(title.startsWith("Untitled")||title.startsWith(INTERACTIVE_NAME))) { GenericDialog gd = new GenericDialog("Enter Interactive Mode"); gd.addMessage("Enter mode that supports interactive\nediting and running of macros and scripts?"); gd.setOKLabel("Enter"); gd.showDialog(); if (gd.wasCanceled()) return; } String language = title.endsWith(".js")?"JavaScript ":"Macro "; messageCount++; String help = messageCount<=2?" Type \"help\" for info.":""; ta.appendText("["+language+"interactive mode."+help+"]\n"); interactiveMode = true; }
private void enterInteractiveMode() { if (interactiveMode) return; String title = getTitle(); if (ta!=null && ta.getText().length()>400 && !(title.startsWith("Untitled")||title.startsWith(INTERACTIVE_NAME))) { GenericDialog gd = new GenericDialog("Enter Interactive Mode"); gd.addMessage("Enter mode that supports interactive\nediting and running of macros and scripts?"); gd.setOKLabel("Enter"); gd.showDialog(); if (gd.wasCanceled()) return; } String language = title.endsWith(".js")?"JavaScript ":"Macro "; messageCount++; String help = messageCount<=2?" Type \"help\" for info.":""; ta.appendText("["+language+"interactive mode."+help+"]\n"); interactiveMode = true; }
private synchronized boolean promptForSave(final String tableTitle) { final GenericDialog gd = new GenericDialog("Unsaved Data"); gd.addMessage("Save measurements in " + tableTitle + "?", new Font("SansSerif", Font.BOLD, 12)); gd.addMessage("Data will be discarded if you dismiss this prompt!", new Font("SansSerif", Font.PLAIN, 12), EnhancedGenericDialog.getDisabledComponentColor()); gd.setCancelLabel("No. Discard measurements"); gd.setOKLabel("Yes. Save to..."); gd.showDialog(); if (gd.wasOKed() && (new MeasurementsWriter()).save("")) { setUnsavedMeasurements(false); } return false; }
GenericDialog gd = new GenericDialog("Save as TIFF"); gd.addMessage("\""+ofi.fileName+"\" already exists.\nDo you want to replace it?"); gd.setOKLabel("Replace"); gd.showDialog(); if (gd.wasCanceled())
GenericDialog gd = new GenericDialog("Save as TIFF"); gd.addMessage("\""+ofi.fileName+"\" already exists.\nDo you want to replace it?"); gd.setOKLabel("Replace"); gd.showDialog(); if (gd.wasCanceled())
gd.addMessage("To avoid this dialog, enable" +"\n\"Show all filename extensions\"\nin Finder Preferences."); gd.setOKLabel("Replace"); gd.showDialog(); if (gd.wasCanceled())
gd.addMessage("To avoid this dialog, enable" +"\n\"Show all filename extensions\"\nin Finder Preferences."); gd.setOKLabel("Replace"); gd.showDialog(); if (gd.wasCanceled())
GenericDialog gd = new GenericDialog("Gel Analyzer"); gd.addMessage(msg); gd.setOKLabel("Yes"); gd.showDialog(); if (gd.wasCanceled()) return;
GenericDialog gd = new GenericDialog("Gel Analyzer"); gd.addMessage(msg); gd.setOKLabel("Yes"); gd.showDialog(); if (gd.wasCanceled()) return;
boolean showDialog() { validateFormat(); gd = new NonBlockingGenericDialog("Batch Process"); addPanels(gd); gd.setInsets(15, 0, 5); gd.addChoice("Output_format:", formats, format); gd.setInsets(0, 0, 5); gd.addChoice("Add macro code:", code, code[0]); if (virtualStack==null) gd.addStringField("File name contains:", "", 10); gd.setInsets(15, 10, 0); Dimension screen = IJ.getScreenSize(); gd.addTextAreas(macro, null, screen.width<=600?10:15, 60); addButtons(gd); gd.setOKLabel("Process"); Vector choices = gd.getChoices(); Choice choice = (Choice)choices.elementAt(1); if (virtualStack!=null) gd.addHelp(help); choice.addItemListener(this); gd.showDialog(); format = gd.getNextChoice(); if (virtualStack==null) filter = gd.getNextString(); macro = gd.getNextText(); return !gd.wasCanceled(); }
private boolean showDialog() { gd = new GenericDialog("Batch Convert"); addPanels(gd); gd.setInsets(15, 0, 5); gd.addChoice("Output_format:", formats, format); gd.addChoice("Interpolation:", methods, methods[interpolationMethod]); //gd.addStringField("Height (pixels): ", height==0?"\u2014":""+height, 6); gd.addNumericField("Scale factor:", scale, 2); gd.addCheckbox("Average when downsizing", averageWhenDownSizing); gd.addCheckbox("Read images using Bio-Formats", useBioFormats); gd.setOKLabel("Convert"); gd.showDialog(); if (gd.wasCanceled()) return false; format = gd.getNextChoice(); interpolationMethod = gd.getNextChoiceIndex(); //height = (int)Tools.parseDouble(gd.getNextString(), 0.0); scale = gd.getNextNumber(); averageWhenDownSizing = gd.getNextBoolean(); useBioFormats = gd.getNextBoolean(); return true; }
boolean showDialog() { validateFormat(); gd = new NonBlockingGenericDialog("Batch Process"); addPanels(gd); gd.setInsets(15, 0, 5); gd.addChoice("Output_format:", formats, format); gd.setInsets(0, 0, 5); gd.addChoice("Add macro code:", code, code[0]); if (virtualStack==null) gd.addStringField("File name contains:", "", 10); gd.setInsets(15, 10, 0); Dimension screen = IJ.getScreenSize(); gd.addTextAreas(macro, null, screen.width<=600?10:15, 60); addButtons(gd); gd.setOKLabel("Process"); Vector choices = gd.getChoices(); Choice choice = (Choice)choices.elementAt(1); if (virtualStack!=null) gd.addHelp(help); choice.addItemListener(this); gd.showDialog(); format = gd.getNextChoice(); if (virtualStack==null) filter = gd.getNextString(); macro = gd.getNextText(); return !gd.wasCanceled(); }
private boolean showDialog() { gd = new GenericDialog("Batch Convert"); addPanels(gd); gd.setInsets(15, 0, 5); gd.addChoice("Output_format:", formats, format); gd.addChoice("Interpolation:", methods, methods[interpolationMethod]); //gd.addStringField("Height (pixels): ", height==0?"\u2014":""+height, 6); gd.addNumericField("Scale factor:", scale, 2); gd.addCheckbox("Average when downsizing", averageWhenDownSizing); gd.addCheckbox("Read images using Bio-Formats", useBioFormats); gd.setOKLabel("Convert"); gd.showDialog(); if (gd.wasCanceled()) return false; format = gd.getNextChoice(); interpolationMethod = gd.getNextChoiceIndex(); //height = (int)Tools.parseDouble(gd.getNextString(), 0.0); scale = gd.getNextNumber(); averageWhenDownSizing = gd.getNextBoolean(); useBioFormats = gd.getNextBoolean(); return true; }
gd.setOKLabel("Close"); gd.hideCancelButton(); gd.showDialog();
gd.setOKLabel("Close"); gd.hideCancelButton(); gd.showDialog();
/** Overrides PlugInFrame.close(). */ public void close() { super.close(); instance = null; resetMultiMeasureResults(); Prefs.saveLocation(LOC_KEY, getLocation()); if (!showAllCheckbox.getState() || IJ.macroRunning()) return; int n = getCount(); ImagePlus imp = WindowManager.getCurrentImage(); if (imp==null || (imp.getCanvas()!=null && imp.getCanvas().getShowAllList()==null)) return; if (n>0) { GenericDialog gd = new GenericDialog("ROI Manager"); gd.addMessage("Save the "+n+" displayed ROIs as an overlay?"); gd.setOKLabel("Discard"); gd.setCancelLabel("Save as Overlay"); gd.showDialog(); if (gd.wasCanceled()) moveRoisToOverlay(imp); else removeOverlay(imp); } else imp.draw(); }
/** Overrides PlugInFrame.close(). */ public void close() { super.close(); instance = null; resetMultiMeasureResults(); Prefs.saveLocation(LOC_KEY, getLocation()); if (!showAllCheckbox.getState() || IJ.macroRunning()) return; int n = getCount(); ImagePlus imp = WindowManager.getCurrentImage(); if (imp==null || (imp.getCanvas()!=null && imp.getCanvas().getShowAllList()==null)) return; if (n>0) { GenericDialog gd = new GenericDialog("ROI Manager"); gd.addMessage("Save the "+n+" displayed ROIs as an overlay?"); gd.setOKLabel("Discard"); gd.setCancelLabel("Save as Overlay"); gd.showDialog(); if (gd.wasCanceled()) moveRoisToOverlay(imp); else removeOverlay(imp); } else imp.draw(); }
public void showDialog() { Color color = Toolbar.getForegroundColor(); String colorName = Colors.colorToString2(color); gd = new NonBlockingGenericDialog("Overlay Brush Options"); gd.addSlider("Brush width (pixels):", 0, 50, width); gd.addSlider("Transparency (%):", 0, 100, transparency); gd.addChoice("Color:", Colors.getColors(colorName), colorName); gd.setInsets(10, 0, 0); String ctrlString = IJ.isMacintosh()? "CMD":"CTRL"; gd.addMessage("SHIFT for horizontal or vertical lines\n"+ "ALT to draw in background color\n"+ ctrlString+"-SHIFT-drag to change brush width\n"+ ctrlString+"-(ALT) click to change foreground (background) color\n"+ "or use this dialog or the Color Picker (shift-k).", null, Color.darkGray); gd.hideCancelButton(); gd.addHelp(""); gd.setHelpLabel("Undo"); gd.setOKLabel("Close"); gd.addDialogListener(this); Point loc = Prefs.getLocation(LOC_KEY); if (loc!=null) { gd.centerDialog(false); gd.setLocation (loc); } gd.showDialog(); Prefs.saveLocation(LOC_KEY, gd.getLocation()); if (IJ.debugMode) IJ.log("Options: false"); gd = null; }
public void showDialog() { Color color = Toolbar.getForegroundColor(); String colorName = Colors.colorToString2(color); gd = new NonBlockingGenericDialog("Overlay Brush Options"); gd.addSlider("Brush width (pixels):", 0, 50, width); gd.addSlider("Transparency (%):", 0, 100, transparency); gd.addChoice("Color:", Colors.getColors(colorName), colorName); gd.setInsets(10, 0, 0); String ctrlString = IJ.isMacintosh()? "CMD":"CTRL"; gd.addMessage("SHIFT for horizontal or vertical lines\n"+ "ALT to draw in background color\n"+ ctrlString+"-SHIFT-drag to change brush width\n"+ ctrlString+"-(ALT) click to change foreground (background) color\n"+ "or use this dialog or the Color Picker (shift-k).", null, Color.darkGray); gd.hideCancelButton(); gd.addHelp(""); gd.setHelpLabel("Undo"); gd.setOKLabel("Close"); gd.addDialogListener(this); Point loc = Prefs.getLocation(LOC_KEY); if (loc!=null) { gd.centerDialog(false); gd.setLocation (loc); } gd.showDialog(); Prefs.saveLocation(LOC_KEY, gd.getLocation()); if (IJ.debugMode) IJ.log("Options: false"); gd = null; }