void setIcon() throws Exception { URL url = this.getClass().getResource("/microscope.gif"); if (url==null) return; Image img = createImage((ImageProducer)url.getContent()); if (img!=null) setIconImage(img); }
void setIcon() throws Exception { URL url = this.getClass().getResource("/microscope.gif"); if (url==null) return; Image img = createImage((ImageProducer)url.getContent()); if (img!=null) setIconImage(img); }
synchronized private JFrame newJFrame(final String title) { final JFrame frame = new JFrame(title); if (null == icon) { try { Field mic = ImageJ.class.getDeclaredField("iconPath"); mic.setAccessible(true); String path = (String) mic.get(IJ.getInstance()); icon = IJ.getInstance().createImage((ImageProducer) new URL("file:" + path).getContent()); } catch (Exception e) {} } if (null != icon) frame.setIconImage(icon); return frame; } }
public Object getTransferData(DataFlavor flavor) throws UnsupportedFlavorException { if (!isDataFlavorSupported(flavor)) throw new UnsupportedFlavorException(flavor); int w = ip.getWidth(); int h = ip.getHeight(); Image img = IJ.getInstance().createImage(w, h); Graphics g = img.getGraphics(); g.drawImage(ip.createImage(), 0, 0, null); g.dispose(); return img; } }, null);
public static void run(String title, String iconPath) { try { ImageJ ij = IJ.getInstance(); if (ij == null) return; if (title != null) ij.setTitle(title); URL url = new URL(iconPath); ImageProducer ip = (ImageProducer)url.getContent(); Image img = ij.createImage(ip); if (img!=null) ij.setIconImage(img); } catch (Exception e) { IJ.error("Could not set the icon: '" + iconPath + "'"); e.printStackTrace(); } } }
Image img = IJ.getInstance().createImage(imageWidth, imageHeight); Graphics g = img.getGraphics(); g.setColor(Color.white);
Image img = IJ.getInstance().createImage(imageWidth, imageHeight); Graphics g = img.getGraphics(); g.setColor(Color.white);
if (iconURL != null) try { final Object producer = iconURL.getContent(); final Image image = ij1.createImage((ImageProducer) producer); ij1.setIconImage(image); if (IJ.isMacOSX()) try {
public Object getTransferData(DataFlavor flavor) throws UnsupportedFlavorException { if (!isDataFlavorSupported(flavor)) throw new UnsupportedFlavorException(flavor); ImagePlus imp = WindowManager.getCurrentImage(); if (imp!=null) { imp = flatten(imp); ImageProcessor ip; if (imp.isComposite()) { ip = new ColorProcessor(imp.getImage()); ip.setRoi(imp.getRoi()); } else ip = imp.getProcessor(); ip = ip.crop(); int w = ip.getWidth(); int h = ip.getHeight(); IJ.showStatus(w+"x"+h+ " image copied to system clipboard"); Image img = IJ.getInstance().createImage(w, h); Graphics g = img.getGraphics(); g.drawImage(ip.createImage(), 0, 0, null); g.dispose(); return img; } else { //IJ.noImage(); return null; } }
public Object getTransferData(DataFlavor flavor) throws UnsupportedFlavorException { if (!isDataFlavorSupported(flavor)) throw new UnsupportedFlavorException(flavor); ImagePlus imp = WindowManager.getCurrentImage(); if (imp!=null) { imp = flatten(imp); ImageProcessor ip; if (imp.isComposite()) { ip = new ColorProcessor(imp.getImage()); ip.setRoi(imp.getRoi()); } else ip = imp.getProcessor(); ip = ip.crop(); int w = ip.getWidth(); int h = ip.getHeight(); IJ.showStatus(w+"x"+h+ " image copied to system clipboard"); Image img = IJ.getInstance().createImage(w, h); Graphics g = img.getGraphics(); g.drawImage(ip.createImage(), 0, 0, null); g.dispose(); return img; } else { //IJ.noImage(); return null; } }
if (url!=null) { Image img = null; try {img = ij.createImage((ImageProducer)url.getContent());} catch(Exception e) {} if (img!=null) {
if (url!=null) { Image img = null; try {img = ij.createImage((ImageProducer)url.getContent());} catch(Exception e) {} if (img!=null) {