@SuppressWarnings("unchecked") public static List<Choice> getChoices(GenericDialog gd) { return gd.getChoices(); }
@SuppressWarnings("unchecked") public static List<Choice> getChoices(GenericDialog gd) { return gd.getChoices(); }
private String getChoice(int i) { Choice c = (Choice)gd.getChoices().get(i); return c.getSelectedItem(); }
private void setChoice(int i, String val) { ((Choice)gd.getChoices().get(i)).select(val); }
void setColor(Color c) { String name = Colors.getColorName(c, ""); if (name.length() > 0) { Vector choices = gd.getChoices(); Choice ch = (Choice)choices.elementAt(0); ch.select(name); } }
private void setColor(Color c) { if (gd==null) return; String name = Colors.colorToString2(c); if (name.length()>0) { Vector choices = gd.getChoices(); Choice ch = (Choice)choices.elementAt(0); ch.select(name); } }
void setColor(Color c) { String name = Colors.getColorName(c, ""); if (name.length() > 0) { Vector choices = gd.getChoices(); Choice ch = (Choice)choices.elementAt(0); ch.select(name); } }
private void setColor(Color c) { if (gd==null) return; String name = Colors.colorToString2(c); if (name.length()>0) { Vector choices = gd.getChoices(); Choice ch = (Choice)choices.elementAt(0); ch.select(name); } }
@Override public void actionPerformed(ActionEvent event) { // switch sides Vector v = gd.getChoices(); for (int i = 0; i < materialList.length; i++) { Choice c = (Choice)v.get(i); int oppositeIndex = getOppositeMaterial( c.getSelectedIndex()); if (oppositeIndex >= 0) c.select(oppositeIndex); } }
void adjustMaterial(boolean fromTemplate) { Choice c1 = (Choice)gd.getChoices().get(0); Choice c2 = (Choice)gd.getChoices().get(2); if (fromTemplate) { Choice c3 = c1; c1 = c2; c2 = c3; } int index = c1.getSelectedIndex(); String chosen = c1.getItem(index); for (int i = 0; i < c2.getItemCount(); i++) if (chosen.equals(c2.getItem(i))) { c2.select(i); return; } if (c2.getSelectedIndex() < 0) c2.select(0); } }
public static void update() { if (gd!=null && gd.isShowing()) { Vector choices = gd.getChoices(); if (choices==null || choices.size()<4) return; Choice counterChoice = (Choice)choices.elementAt(3); int counter = getCounter(); int count = getCount(counter); counterChoice.select(counter); ((Label)gd.getMessage()).setText(""+count); } }
public static void update() { if (gd!=null && gd.isShowing()) { Vector choices = gd.getChoices(); if (choices==null || choices.size()<4) return; Choice counterChoice = (Choice)choices.elementAt(3); int counter = getCounter(); int count = getCount(counter); counterChoice.select(counter); ((Label)gd.getMessage()).setText(""+count); } }
void getMaterials2() { Choice templateChoice = (Choice)gd.getChoices().get(1); int index = templateChoice.getSelectedIndex(); if (index < 0) index = 0; String template = templateChoice.getItem(index); ImagePlus t = WindowManager.getImage(template); AmiraParameters params = new AmiraParameters(t); materials2 = params.getMaterialList(); Choice mat2 = (Choice)gd.getChoices().get(2); String chosen = (mat2 == null ? null : mat2.getItem(mat2.getSelectedIndex())); mat2.removeAll(); int selectedIndex = 0; for (int i = 0; i < materials2.length; i++) { mat2.addItem(materials2[i]); if (chosen != null && materials2[i].equals(chosen)) selectedIndex = i; } if (chosen == null) adjustMaterial(false); else mat2.select(selectedIndex); }
private boolean showDialog() { gd = new GenericDialog("Startup Macro"); String text = "Macro code contained in this text area\nexecutes when ImageJ starts up."; Font font = new Font("SansSerif", Font.PLAIN, 14); gd.setInsets(5,15,0); gd.addMessage(text, font); gd.setInsets(5, 10, 0); gd.addTextAreas(macro, null, 12, 50); gd.addChoice("Add code:", code, code[0]); Vector choices = gd.getChoices(); if (choices!=null) { Choice choice = (Choice)choices.elementAt(0); choice.addItemListener(this); } gd.showDialog(); macro = gd.getNextText(); return !gd.wasCanceled(); }
final int i_last = last.getParent().indexOf(last); gd.addChoice("Start: ", layers, layers[i_first]); final Vector<?> v = gd.getChoices(); final Choice cstart = (Choice)v.get(v.size()-1); gd.addChoice("End: ", layers, layers[i_last]);
private boolean showDialog() { gd = new GenericDialog("Startup Macro"); String text = "Macro code contained in this text area\nexecutes when ImageJ starts up."; Font font = new Font("SansSerif", Font.PLAIN, 14); gd.setInsets(5,15,0); gd.addMessage(text, font); gd.setInsets(5, 10, 0); gd.addTextAreas(macro, null, 12, 50); gd.addChoice("Add code:", code, code[0]); Vector choices = gd.getChoices(); if (choices!=null) { Choice choice = (Choice)choices.elementAt(0); choice.addItemListener(this); } gd.showDialog(); macro = gd.getNextText(); return !gd.wasCanceled(); }
gd.addStringField("value", ""); Vector v = gd.getChoices(); windowList = (Choice)v.get(0); v = gd.getStringFields();
final Choice choice = (Choice)gd1.getChoices().lastElement();
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(); }
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(); }