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

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

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

Toolbar.getToolName介绍

[英]Returns the name of the current tool.
[中]返回当前工具的名称。

代码示例

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

/** Returns the name of the current tool. */
public static String getToolName() {
  return Toolbar.getToolName();
}

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

/** Returns the name of the current tool. */
public static String getToolName() {
  return Toolbar.getToolName();
}

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

private boolean drawingTool() {
  return Toolbar.getToolName().equals("Paintbrush Tool") || Toolbar.getToolName().equals("Pencil Tool");
}

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

private boolean drawingTool() {
  return Toolbar.getToolName().equals("Paintbrush Tool") || Toolbar.getToolName().equals("Pencil Tool");
}

代码示例来源: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: imagej/ImageJA

private void setTool2(int tool) {
  if (!isValidTool(tool)) return;
  String previousName = getToolName();
  current = tool;
  Graphics g = this.getGraphics();
  if (!previousName.equals(getToolName())) {
    IJ.notifyEventListeners(IJEventListener.TOOL_CHANGED);;
    repaint();

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

private void setTool2(int tool) {
  if (!isValidTool(tool)) return;
  String previousName = getToolName();
  current = tool;
  Graphics g = this.getGraphics();
  if (!previousName.equals(getToolName())) {
    IJ.notifyEventListeners(IJEventListener.TOOL_CHANGED);;
    repaint();

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

public void itemStateChanged(ItemEvent e) {
  CheckboxMenuItem item = (CheckboxMenuItem)e.getSource();
  String previousName = getToolName();
  if (item==rectItem || item==roundRectItem || item==rotatedRectItem) {
    if (item==roundRectItem)
    if (roi!=null && roi.getType()==Roi.RECTANGLE)
      roi.setCornerDiameter(rectType==ROUNDED_RECT_ROI?arcSize:0);
    if (!previousName.equals(getToolName()))
      IJ.notifyEventListeners(IJEventListener.TOOL_CHANGED);
  } else if (item==ovalItem || item==ellipseItem || item==brushItem) {
    repaintTool(OVAL);
    showMessage(OVAL);
    if (!previousName.equals(getToolName()))
      IJ.notifyEventListeners(IJEventListener.TOOL_CHANGED);
  } else if (item==pointItem || item==multiPointItem) {
    repaintTool(POINT);
    showMessage(POINT);
    if (!previousName.equals(getToolName()))
      IJ.notifyEventListeners(IJEventListener.TOOL_CHANGED);
  } else if (item==straightLineItem) {

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

public void itemStateChanged(ItemEvent e) {
  CheckboxMenuItem item = (CheckboxMenuItem)e.getSource();
  String previousName = getToolName();
  if (item==rectItem || item==roundRectItem || item==rotatedRectItem) {
    if (item==roundRectItem)
    if (roi!=null && roi.getType()==Roi.RECTANGLE)
      roi.setCornerDiameter(rectType==ROUNDED_RECT_ROI?arcSize:0);
    if (!previousName.equals(getToolName()))
      IJ.notifyEventListeners(IJEventListener.TOOL_CHANGED);
  } else if (item==ovalItem || item==ellipseItem || item==brushItem) {
    repaintTool(OVAL);
    showMessage(OVAL);
    if (!previousName.equals(getToolName()))
      IJ.notifyEventListeners(IJEventListener.TOOL_CHANGED);
  } else if (item==pointItem || item==multiPointItem) {
    repaintTool(POINT);
    showMessage(POINT);
    if (!previousName.equals(getToolName()))
      IJ.notifyEventListeners(IJEventListener.TOOL_CHANGED);
  } else if (item==straightLineItem) {

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

public boolean dialogItemChanged(GenericDialog gd, AWTEvent e) {
  double strokeWidth2 = gd.getNextNumber();
  int cornerDiameter2 = (int)gd.getNextNumber();
  String strokec2 = gd.getNextString();
  String fillc2 = gd.getNextString();
  ImagePlus imp = WindowManager.getCurrentImage();
  Roi roi = imp!=null?imp.getRoi():null;
  Color strokeColor2 = Colors.decode(strokec2, defaultStrokeColor);
  if (roi!=null && (roi.getType()==Roi.RECTANGLE)) {
    roi.setStrokeWidth((int)strokeWidth2);
    roi.setCornerDiameter((int)(cornerDiameter2));
    strokeColor2 = Colors.decode(strokec2, roi.getStrokeColor());
    Color fillColor = Colors.decode(fillc2, roi.getFillColor());
    roi.setStrokeColor(strokeColor2);
    roi.setFillColor(fillColor);
  }
  defaultStrokeWidth = strokeWidth2;
  defaultStrokeColor = strokeColor2;
  Toolbar.setRoundRectArcSize(cornerDiameter2);
  if (cornerDiameter2>0) {
    if (!Toolbar.getToolName().equals("roundrect"))
      IJ.setTool("roundrect");
  }
  return true;
}

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

public boolean dialogItemChanged(GenericDialog gd, AWTEvent e) {
  double strokeWidth2 = gd.getNextNumber();
  int cornerDiameter2 = (int)gd.getNextNumber();
  String strokec2 = gd.getNextString();
  String fillc2 = gd.getNextString();
  ImagePlus imp = WindowManager.getCurrentImage();
  Roi roi = imp!=null?imp.getRoi():null;
  Color strokeColor2 = Colors.decode(strokec2, defaultStrokeColor);
  if (roi!=null && (roi.getType()==Roi.RECTANGLE)) {
    roi.setStrokeWidth((int)strokeWidth2);
    roi.setCornerDiameter((int)(cornerDiameter2));
    strokeColor2 = Colors.decode(strokec2, roi.getStrokeColor());
    Color fillColor = Colors.decode(fillc2, roi.getFillColor());
    roi.setStrokeColor(strokeColor2);
    roi.setFillColor(fillColor);
  }
  defaultStrokeWidth = strokeWidth2;
  defaultStrokeColor = strokeColor2;
  Toolbar.setRoundRectArcSize(cornerDiameter2);
  if (cornerDiameter2>0) {
    if (!Toolbar.getToolName().equals("roundrect"))
      IJ.setTool("roundrect");
  }
  return true;
}

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

void arrowToolOptions() {
  if (!Toolbar.getToolName().equals("arrow"))
    IJ.setTool("arrow");
  double width = Arrow.getDefaultWidth();
  double headSize = Arrow.getDefaultHeadSize();
  Color color = Toolbar.getForegroundColor();
  colorName = Colors.colorToString2(color);
  int style = Arrow.getDefaultStyle();
  gd = new NonBlockingGenericDialog("Arrow Tool");
  gd.addSlider("Width:", 1, 50, (int)width);
  gd.addSlider("Size:", 0, 50, headSize);
  gd.addChoice("Color:", Colors.getColors(colorName), colorName);
  gd.addChoice("Style:", Arrow.styles, Arrow.styles[style]);
  gd.addCheckbox("Outline", Arrow.getDefaultOutline());
  gd.addCheckbox("Double head", Arrow.getDefaultDoubleHeaded());
  gd.addCheckbox("Keep after adding to overlay", Prefs.keepArrowSelections);
  gd.addDialogListener(this);
  Point loc = Prefs.getLocation(LOC_KEY);
  if (loc!=null) {
    gd.centerDialog(false);
    gd.setLocation (loc);
  }
  gd.showDialog();
  Prefs.saveLocation(LOC_KEY, gd.getLocation());
}

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

void arrowToolOptions() {
  if (!Toolbar.getToolName().equals("arrow"))
    IJ.setTool("arrow");
  double width = Arrow.getDefaultWidth();
  double headSize = Arrow.getDefaultHeadSize();
  Color color = Toolbar.getForegroundColor();
  colorName = Colors.colorToString2(color);
  int style = Arrow.getDefaultStyle();
  gd = new NonBlockingGenericDialog("Arrow Tool");
  gd.addSlider("Width:", 1, 50, (int)width);
  gd.addSlider("Size:", 0, 50, headSize);
  gd.addChoice("Color:", Colors.getColors(colorName), colorName);
  gd.addChoice("Style:", Arrow.styles, Arrow.styles[style]);
  gd.addCheckbox("Outline", Arrow.getDefaultOutline());
  gd.addCheckbox("Double head", Arrow.getDefaultDoubleHeaded());
  gd.addCheckbox("Keep after adding to overlay", Prefs.keepArrowSelections);
  gd.addDialogListener(this);
  Point loc = Prefs.getLocation(LOC_KEY);
  if (loc!=null) {
    gd.centerDialog(false);
    gd.setLocation (loc);
  }
  gd.showDialog();
  Prefs.saveLocation(LOC_KEY, gd.getLocation());
}

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

break;
case Toolbar.LINE:
  if ("arrow".equals(Toolbar.getToolName()))
    roi = new Arrow(sx, sy, this);
  else

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

break;
case Toolbar.LINE:
  if ("arrow".equals(Toolbar.getToolName()))
    roi = new Arrow(sx, sy, this);
  else

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

return;
savedToolName = Toolbar.getToolName();

相关文章