/** Change the brush size by the given length increment (in pixel units). A lower limit of 1 pixel is preserved. Returns the value finally accepted for brush size.*/ static public int setBrushSize(int inc) { int brushSize = 15; try { java.lang.reflect.Field f = Toolbar.class.getDeclaredField("brushSize"); f.setAccessible(true); brushSize = ((Integer)f.get(Toolbar.getInstance())).intValue(); if (brushSize + inc < 1) brushSize = 1; else brushSize += inc; f.setInt(Toolbar.getInstance(), brushSize); } catch (Exception e) {} return brushSize; }
/** Hacks on the ij.gui.Toolbar to get the proper value, and defaults to 15 if the value is absurd. */ static public int getBrushSize() { int brushSize = 15; try { java.lang.reflect.Field f = Toolbar.class.getDeclaredField("brushSize"); f.setAccessible(true); brushSize = ((Integer)f.get(Toolbar.getInstance())).intValue(); if (brushSize < 1) brushSize = 15; } catch (Exception e) {} return brushSize; }
SwingUtilities.invokeLater(new Runnable() { public void run() { fr.setVisible(false); fr.dispose(); if (null != ij.gui.Toolbar.getInstance()) ij.gui.Toolbar.getInstance().repaint(); }}); frame = null;
/** Switches to the specified tool, where id = Toolbar.RECTANGLE (0), Toolbar.OVAL (1), etc. */ public static void setTool(int id) { Toolbar.getInstance().setTool(id); }
/** Switches to the specified tool, where 'name' is "rect", "elliptical", "brush", etc. Returns 'false' if the name is not recognized. */ public static boolean setTool(String name) { return Toolbar.getInstance().setTool(name); }
/** * Return true if the tool is currently present in ImageJ toolbar. */ public static boolean isLaunched() { final Toolbar toolbar = Toolbar.getInstance(); if ( null != toolbar && toolbar.getToolId( TOOL_NAME ) >= 0 ) return true; return false; }
/** * Return true if the tool is currently present in ImageJ toolbar. */ public static boolean isLaunched() { final Toolbar toolbar = Toolbar.getInstance(); if ( null != toolbar && toolbar.getToolId( TOOL_NAME ) >= 0 ) return true; return false; }
/** Switches to the specified tool, where id = Toolbar.RECTANGLE (0), Toolbar.OVAL (1), etc. */ public static void setTool(int id) { Toolbar.getInstance().setTool(id); }
/** Switches to the specified tool, where 'name' is "rect", "elliptical", "brush", etc. Returns 'false' if the name is not recognized. */ public static boolean setTool(String name) { return Toolbar.getInstance().setTool(name); }
@Override public void setTool(final int id) { Toolbar.getInstance().setTool(id); }
void restorePreviousTool() { interp.getParens(); Toolbar tb = Toolbar.getInstance(); if (tb!=null) tb.restorePreviousTool(); }
void restorePreviousTool() { interp.getParens(); Toolbar tb = Toolbar.getInstance(); if (tb!=null) tb.restorePreviousTool(); }
protected boolean wasToolbarCleared() { Toolbar current = Toolbar.getInstance(); if (current != toolbar) return true; /* * We need to compare with != rather than !equals() so that subsequent calls * of the same plugin will not result in multiple handling. */ if (Toolbar.getToolId() == toolID && Toolbar.getToolName() != savedToolName) return true; return false; }
static void repaintTool(int tool) { if (IJ.getInstance()!=null) { Toolbar tb = getInstance(); Graphics g = tb.getGraphics(); if (IJ.debugMode) IJ.log("Toolbar.repaintTool: "+tool+" "+g); if (g==null) return; if (Prefs.antialiasedTools) ((Graphics2D)g).setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); tb.drawButton(g, tool); if (g!=null) g.dispose(); } }
static void repaintTool(int tool) { if (IJ.getInstance()!=null) { Toolbar tb = getInstance(); Graphics g = tb.getGraphics(); if (IJ.debugMode) IJ.log("Toolbar.repaintTool: "+tool+" "+g); if (g==null) return; if (Prefs.antialiasedTools) ((Graphics2D)g).setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); tb.drawButton(g, tool); if (g!=null) g.dispose(); } }
public static void restoreTools() { Toolbar tb = Toolbar.getInstance(); if (tb!=null) { if (tb.getToolId()>=UNUSED) tb.setTool(RECTANGLE); tb.installStartupMacros(); } }
public static void restoreTools() { Toolbar tb = Toolbar.getInstance(); if (tb!=null) { if (tb.getToolId()>=UNUSED) tb.setTool(RECTANGLE); tb.installStartupMacros(); } }
private ControlWindow() { if (null != ij.gui.Toolbar.getInstance()) { ij.gui.Toolbar.getInstance().addMouseListener(tool_listener); } Utils.setup(this); Loader.setupPreloader(this); if (IJ.isWindows() && isGUIEnabled()) StdOutWindow.start(); Display3D.init(); setLookAndFeel(); this.command_listener = new ImageJCommandListener(); this.red_phone.start(); }
public void run(String arg) { ImageJ ij = IJ.getInstance(); ij.setDropTarget(null); new DropTarget(ij, this); new DropTarget(Toolbar.getInstance(), this); new DropTarget(ij.getStatusBar(), this); }
public void run(String arg) { ImageJ ij = IJ.getInstance(); ij.setDropTarget(null); new DropTarget(ij, this); new DropTarget(Toolbar.getInstance(), this); new DropTarget(ij.getStatusBar(), this); }