void showHelp() { if (helpURL.startsWith("<html>")) { if (this instanceof NonBlockingGenericDialog) new HTMLDialog("", helpURL, false); // non blocking else new HTMLDialog(this, "", helpURL); //modal } else { String macro = "run('URL...', 'url="+helpURL+"');"; new MacroRunner(macro); } }
public void actionPerformed(ActionEvent e) { dispose(); }
public HTMLDialog(Dialog parent, String title, String message) { super(parent, title, true); init(message); }
private void init(String message) { ij.util.Java2.setSystemLookAndFeel(); Container container = getContentPane(); container.setLayout(new BorderLayout()); if (message==null) message = ""; panel.add(button); container.add(panel, "South"); setForeground(Color.black); pack(); Dimension screenD = IJ.getScreenSize(); Dimension dialogD = getSize(); int maxWidth = (int)(Math.min(0.70*screenD.width, 800)); //max 70% of screen width, but not more than 800 pxl if (maxWidth>400 && dialogD.width>maxWidth) if (dialogD.height > 0.80*screenD.height && screenD.height>400) //max 80% of screen height dialogD.height = (int)(0.80*screenD.height); setSize(dialogD); GUI.center(this); if (!modal) WindowManager.addWindow(this); show();
/** Displays a message in a dialog box with the specified title. Displays HTML formatted text if 'msg' starts with "<html>". There are examples at "http://imagej.nih.gov/ij/macros/HtmlDialogDemo.txt". Writes to the Java console if ImageJ is not present. */ public static void showMessage(String title, String msg) { if (ij!=null) { if (msg!=null && (msg.startsWith("<html>")||msg.startsWith("<HTML>"))) { HTMLDialog hd = new HTMLDialog(title, msg); if (isMacro() && hd.escapePressed()) throw new RuntimeException(Macro.MACRO_CANCELED); } else { MessageDialog md = new MessageDialog(ij, title, msg); if (isMacro() && md.escapePressed()) throw new RuntimeException(Macro.MACRO_CANCELED); } } else System.out.println(msg); }
private void init(String message) { ij.util.Java2.setSystemLookAndFeel(); Container container = getContentPane(); container.setLayout(new BorderLayout()); if (message==null) message = ""; panel.add(button); container.add(panel, "South"); setForeground(Color.black); pack(); Dimension screenD = IJ.getScreenSize(); Dimension dialogD = getSize(); int maxWidth = (int)(Math.min(0.70*screenD.width, 800)); //max 70% of screen width, but not more than 800 pxl if (maxWidth>400 && dialogD.width>maxWidth) if (dialogD.height > 0.80*screenD.height && screenD.height>400) //max 80% of screen height dialogD.height = (int)(0.80*screenD.height); setSize(dialogD); GUI.center(this); if (!modal) WindowManager.addWindow(this); show();
/** Displays a message in a dialog box with the specified title. Displays HTML formatted text if 'msg' starts with "<html>". There are examples at "http://imagej.nih.gov/ij/macros/HtmlDialogDemo.txt". Writes to the Java console if ImageJ is not present. */ public static void showMessage(String title, String msg) { if (ij!=null) { if (msg!=null && (msg.startsWith("<html>")||msg.startsWith("<HTML>"))) { HTMLDialog hd = new HTMLDialog(title, msg); if (isMacro() && hd.escapePressed()) throw new RuntimeException(Macro.MACRO_CANCELED); } else { MessageDialog md = new MessageDialog(ij, title, msg); if (isMacro() && md.escapePressed()) throw new RuntimeException(Macro.MACRO_CANCELED); } } else System.out.println(msg); }
void showHelp() { if (helpURL.startsWith("<html>")) { if (this instanceof NonBlockingGenericDialog) new HTMLDialog("", helpURL, false); // non blocking else new HTMLDialog(this, "", helpURL); //modal } else { String macro = "run('URL...', 'url="+helpURL+"');"; new MacroRunner(macro); } }
public HTMLDialog(Dialog parent, String title, String message) { super(parent, title, true); init(message); }
public void actionPerformed(ActionEvent e) { dispose(); }
sb.append("</div>"); sb.append("</html>"); new HTMLDialog("About Sholl Analysis...", sb.toString());
public HTMLDialog(String title, String message) { super(ij.IJ.getInstance(), title, true); init(message); }
public void keyPressed(KeyEvent e) { int keyCode = e.getKeyCode(); ij.IJ.setKeyDown(keyCode); escapePressed = keyCode==KeyEvent.VK_ESCAPE; if (keyCode==KeyEvent.VK_C) { if (editorPane.getSelectedText()==null || editorPane.getSelectedText().length()==0) editorPane.selectAll(); editorPane.copy(); editorPane.select(0,0); } else if (keyCode==KeyEvent.VK_ENTER || keyCode==KeyEvent.VK_W || escapePressed) dispose(); }
sb.append("</div>"); sb.append("</html>"); new HTMLDialog(parentDialog, "Segmentation Details", sb.toString());
public HTMLDialog(String title, String message, boolean modal) { super(ij.IJ.getInstance(), title, modal); this.modal = modal; init(message); }
public void keyPressed(KeyEvent e) { int keyCode = e.getKeyCode(); ij.IJ.setKeyDown(keyCode); escapePressed = keyCode==KeyEvent.VK_ESCAPE; if (keyCode==KeyEvent.VK_C) { if (editorPane.getSelectedText()==null || editorPane.getSelectedText().length()==0) editorPane.selectAll(); editorPane.copy(); editorPane.select(0,0); } else if (keyCode==KeyEvent.VK_ENTER || keyCode==KeyEvent.VK_W || escapePressed) dispose(); }
public void actionPerformed(ActionEvent ae) { Object source = ae.getSource(); if (source==runButton) { int row = table.getSelectedRow(); if (row<0) { error("Please select a command to run"); return; } runCommand(tableModel.getCommand(row)); } else if (source==sourceButton) { int row = table.getSelectedRow(); if (row<0) { error("Please select a command"); return; } showSource(tableModel.getCommand(row)); } else if (source == closeButton) { closeWindow(); } else if (source == helpButton) { String text = "<html>Shortcuts:<br>" + " ↑ ↓  Select items<br>" + " ↵  Open item<br>" + " A-Z  Alphabetic scroll<br>" + " ⌫ Activate search field</html>"; new HTMLDialog("", text); } }
public HTMLDialog(String title, String message, boolean modal) { super(ij.IJ.getInstance(), title, modal); this.modal = modal; init(message); }
public void actionPerformed(ActionEvent ae) { Object source = ae.getSource(); if (source==runButton) { int row = table.getSelectedRow(); if (row<0) { error("Please select a command to run"); return; } runCommand(tableModel.getCommand(row)); } else if (source==sourceButton) { int row = table.getSelectedRow(); if (row<0) { error("Please select a command"); return; } showSource(tableModel.getCommand(row)); } else if (source == closeButton) { closeWindow(); } else if (source == helpButton) { String text = "<html>Shortcuts:<br>" + " ↑ ↓  Select items<br>" + " ↵  Open item<br>" + " A-Z  Alphabetic scroll<br>" + " ⌫ Activate search field</html>"; new HTMLDialog("", text); } }
public HTMLDialog(String title, String message) { super(ij.IJ.getInstance(), title, true); init(message); }