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

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

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

Toolbar.addTool介绍

[英]Adds a tool to the toolbar. The 'toolTip' string is displayed in the status bar when the mouse is over the tool icon. The 'toolTip' string may include icon (http://imagej.nih.gov/ij/developer/macro/macros.html#tools). Returns the tool ID, or -1 if all tool slots are in use.
[中]将工具添加到工具栏。当鼠标位于工具图标上方时,“工具提示”字符串将显示在状态栏中。“工具提示”字符串可能包括图标(http://imagej.nih.gov/ij/developer/macro/macros.html#tools).返回刀具ID,如果所有刀具槽都在使用中,则返回-1。

代码示例

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

/** Used by the MacroInstaller class to install a set of macro tools. */
public void addMacroTool(String name, MacroInstaller macroInstaller, int id) {
  if (id==0) {
    resetTools();
    if (name.startsWith("Unused"))
      return;
   }
  if (name.endsWith(" Built-in Tool")) {
    name = name.substring(0,name.length()-14);
    doNotSavePrefs = true;
    boolean ok = installBuiltinTool(name);
    if (!ok) {
      Hashtable commands = Menus.getCommands();
      if (commands!=null && commands.get(name)!=null)
        IJ.run(name);
    }
    doNotSavePrefs = false;
    return;
  }
  this.macroInstaller = macroInstaller;
  int tool = addTool(name);
  this.macroInstaller = null;
  if (tool!=-1)
    tools[tool] = new MacroToolRunner(macroInstaller);
}

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

/** Used by the MacroInstaller class to install a set of macro tools. */
public void addMacroTool(String name, MacroInstaller macroInstaller, int id) {
  if (id==0) {
    resetTools();
    if (name.startsWith("Unused"))
      return;
   }
  if (name.endsWith(" Built-in Tool")) {
    name = name.substring(0,name.length()-14);
    doNotSavePrefs = true;
    boolean ok = installBuiltinTool(name);
    if (!ok) {
      Hashtable commands = Menus.getCommands();
      if (commands!=null && commands.get(name)!=null)
        IJ.run(name);
    }
    doNotSavePrefs = false;
    return;
  }
  this.macroInstaller = macroInstaller;
  int tool = addTool(name);
  this.macroInstaller = null;
  if (tool!=-1)
    tools[tool] = new MacroToolRunner(macroInstaller);
}

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

/** Used by the MacroInstaller class to add a macro tool to the toolbar. */
public void addMacroTool(String name, MacroInstaller macroInstaller) {
  String custom1Name = names[CUSTOM1];
  this.macroInstaller = macroInstaller;
  addingSingleTool = true;
  int tool = addTool(name);
  addingSingleTool = false;
  this.macroInstaller = null;
  if (tool!=-1) {
    tools[tool] = new MacroToolRunner(macroInstaller);
    if (!name.contains(" Menu Tool")) {
      if (menus[tool]!=null)
        menus[tool].removeAll();
      if (!installingStartupTool)
        setTool(tool);
      else
        installingStartupTool = false;
    }
    if ((tool-CUSTOM1)>0 || custom1Name==null)
      setPrefs(tool);
  }
}

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

/** Used by the MacroInstaller class to add a macro tool to the toolbar. */
public void addMacroTool(String name, MacroInstaller macroInstaller) {
  String custom1Name = names[CUSTOM1];
  this.macroInstaller = macroInstaller;
  addingSingleTool = true;
  int tool = addTool(name);
  addingSingleTool = false;
  this.macroInstaller = null;
  if (tool!=-1) {
    tools[tool] = new MacroToolRunner(macroInstaller);
    if (!name.contains(" Menu Tool")) {
      if (menus[tool]!=null)
        menus[tool].removeAll();
      if (!installingStartupTool)
        setTool(tool);
      else
        installingStartupTool = false;
    }
    if ((tool-CUSTOM1)>0 || custom1Name==null)
      setPrefs(tool);
  }
}

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

/** Adds a plugin tool to the first available toolbar slot,
  or to the last slot if the toolbar is full. */
public static void addPlugInTool(PlugInTool tool) {
  if (instance==null) return;
  String nameAndIcon = tool.getToolName()+" - "+tool.getToolIcon();
  instance.addingSingleTool = true;
  int id = instance.addTool(nameAndIcon);
  instance.addingSingleTool = false;
  if (id!=-1) {
    instance.tools[id] = tool;
    if (instance.menus[id]!=null)
      instance.menus[id].removeAll();
    instance.repaintTool(id);    
    if (!instance.installingStartupTool)
      instance.setTool(id);
    else
      instance.installingStartupTool = false;
    instance.setPrefs(id);
  }
}

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

/** Adds a plugin tool to the first available toolbar slot,
  or to the last slot if the toolbar is full. */
public static void addPlugInTool(PlugInTool tool) {
  if (instance==null) return;
  String nameAndIcon = tool.getToolName()+" - "+tool.getToolIcon();
  instance.addingSingleTool = true;
  int id = instance.addTool(nameAndIcon);
  instance.addingSingleTool = false;
  if (id!=-1) {
    instance.tools[id] = tool;
    if (instance.menus[id]!=null)
      instance.menus[id].removeAll();
    instance.repaintTool(id);    
    if (!instance.installingStartupTool)
      instance.setTool(id);
    else
      instance.installingStartupTool = false;
    instance.setPrefs(id);
  }
}

代码示例来源:origin: mpicbg/mpicbg_

Toolbar.getInstance().setTool( Toolbar.getInstance().addTool( "Add_and_drag_handles." ) );

代码示例来源:origin: axtimwalde/mpicbg

Toolbar.getInstance().setTool( Toolbar.getInstance().addTool( "Add_and_drag_handles." ) );

代码示例来源:origin: axtimwalde/mpicbg

Toolbar.getInstance().setTool( Toolbar.getInstance().addTool( "Select_a_Feature" ) );

代码示例来源:origin: mpicbg/mpicbg_

Toolbar.getInstance().setTool( Toolbar.getInstance().addTool( "Select_a_Feature" ) );

代码示例来源:origin: mpicbg/mpicbg

@Override
public void run( final String arg )
{
  /* cleanup */
  m.clear();
  imp = IJ.getImage();
  target = imp.getProcessor();
  source = target.duplicate();
  source.setInterpolationMethod( ImageProcessor.BILINEAR );
  init();
  createMapping();
  painter = new MappingThread(
      imp,
      source,
      target,
      pleaseRepaint,
      mapping,
      interpolate );
  painter.start();
  Toolbar.getInstance().setTool( Toolbar.getInstance().addTool( "Add_and_drag_handles." ) );
  imp.getCanvas().addMouseListener( this );
  imp.getCanvas().addMouseMotionListener( this );
  imp.getCanvas().addKeyListener( this );
  imp.getWindow().addKeyListener( this );
  IJ.getInstance().addKeyListener( this );
}

代码示例来源:origin: axtimwalde/mpicbg

Toolbar.getInstance().setTool( Toolbar.getInstance().addTool( "Drag_the_handles." ) );

代码示例来源:origin: mpicbg/mpicbg

Toolbar.getInstance().setTool( Toolbar.getInstance().addTool( "Drag_the_handles." ) );

代码示例来源:origin: axtimwalde/mpicbg

@Override
public void run( final String arg )
{
  /* cleanup */
  m.clear();
  imp = IJ.getImage();
  target = imp.getProcessor();
  source = target.duplicate();
  source.setInterpolationMethod( ImageProcessor.BILINEAR );
  init();
  createMapping();
  painter = new MappingThread(
      imp,
      source,
      target,
      pleaseRepaint,
      mapping,
      interpolate );
  painter.start();
  Toolbar.getInstance().setTool( Toolbar.getInstance().addTool( "Add_and_drag_handles." ) );
  imp.getCanvas().addMouseListener( this );
  imp.getCanvas().addMouseMotionListener( this );
  imp.getCanvas().addKeyListener( this );
  imp.getWindow().addKeyListener( this );
  IJ.getInstance().addKeyListener( this );
}

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

toolID = toolbar.addTool(getToolName() + " - " + getToolIcon());
if (toolID < 0 && clearToolsIfNecessary) {
  int previousID = toolbar.getToolId();

相关文章