ij.gui.Toolbar.getInstance()方法的使用及代码示例

x33g5p2x  于2022-01-30 转载在 其他  
字(5.5k)|赞(0)|评价(0)|浏览(145)

本文整理了Java中ij.gui.Toolbar.getInstance()方法的一些代码示例,展示了Toolbar.getInstance()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Toolbar.getInstance()方法的具体详情如下:
包路径:ij.gui.Toolbar
类名称:Toolbar
方法名:getInstance

Toolbar.getInstance介绍

[英]Returns a reference to the ImageJ toolbar.
[中]返回对ImageJ工具栏的引用。

代码示例

代码示例来源:origin: sc.fiji/TrakEM2_

/** 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;
}

代码示例来源:origin: sc.fiji/TrakEM2_

/** 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;
}

代码示例来源:origin: sc.fiji/TrakEM2_

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;

代码示例来源:origin: imagej/ImageJA

/** Switches to the specified tool, where id = Toolbar.RECTANGLE (0),
  Toolbar.OVAL (1), etc. */
public static void setTool(int id) {
  Toolbar.getInstance().setTool(id);
}

代码示例来源:origin: imagej/ImageJA

/** 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);
}

代码示例来源:origin: fiji/TrackMate

/**
 * 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;
}

代码示例来源:origin: sc.fiji/TrackMate_

/**
 * 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;
}

代码示例来源:origin: net.imagej/ij

/** Switches to the specified tool, where id = Toolbar.RECTANGLE (0),
  Toolbar.OVAL (1), etc. */
public static void setTool(int id) {
  Toolbar.getInstance().setTool(id);
}

代码示例来源:origin: net.imagej/ij

/** 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);
}

代码示例来源:origin: sc.fiji/3D_Viewer

@Override
public void setTool(final int id) {
  Toolbar.getInstance().setTool(id);
}

代码示例来源:origin: imagej/ImageJA

void restorePreviousTool() {
  interp.getParens();
  Toolbar tb = Toolbar.getInstance();
  if (tb!=null) tb.restorePreviousTool();
}

代码示例来源:origin: net.imagej/ij

void restorePreviousTool() {
  interp.getParens();
  Toolbar tb = Toolbar.getInstance();
  if (tb!=null) tb.restorePreviousTool();
}

代码示例来源:origin: sc.fiji/fiji-lib

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;
}

代码示例来源:origin: net.imagej/ij

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();
  }
}

代码示例来源:origin: imagej/ImageJA

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();
  }
}

代码示例来源:origin: net.imagej/ij

public static void restoreTools() {
  Toolbar tb = Toolbar.getInstance();
  if (tb!=null) {
    if (tb.getToolId()>=UNUSED)
      tb.setTool(RECTANGLE);
    tb.installStartupMacros();
  }
}

代码示例来源:origin: imagej/ImageJA

public static void restoreTools() {
  Toolbar tb = Toolbar.getInstance();
  if (tb!=null) {
    if (tb.getToolId()>=UNUSED)
      tb.setTool(RECTANGLE);
    tb.installStartupMacros();
  }
}

代码示例来源:origin: sc.fiji/TrakEM2_

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();
}

代码示例来源:origin: net.imagej/ij

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);
}

代码示例来源:origin: imagej/ImageJA

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);
}

相关文章