本文整理汇总了Java中ij.gui.Toolbar类的典型用法代码示例。如果您正苦于以下问题:Java Toolbar类的具体用法?Java Toolbar怎么用?Java Toolbar使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
Toolbar类属于ij.gui包,在下文中一共展示了Toolbar类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: turboRegPointToolbar
import ij.gui.Toolbar; //导入依赖的package包/类
/*********************************************************************
* Override the ImageJ toolbar by this
* <code>turboRegToolbar</code> object. Store
* a local copy of the ImageJ's toolbar for
* later restore.
*
* @see turboRegPointToolbar#restorePreviousToolbar()
********************************************************************/
public turboRegPointToolbar(final Toolbar previousToolbar)
{
previousInstance = previousToolbar;
instance = this;
final Container container = previousToolbar.getParent();
final Component[] component = container.getComponents();
for (int i = 0; (i < component.length); i++)
{
if (component[i] == previousToolbar)
{
container.remove(previousToolbar);
container.add(this, i);
break;
}
}
resetButtons();
down[currentTool] = true;
setTool(currentTool);
setForeground(Color.black);
setBackground(gray);
addMouseListener(this);
container.validate();
}
示例2: unwarpJPointToolbar
import ij.gui.Toolbar; //导入依赖的package包/类
public unwarpJPointToolbar (
final Toolbar previousToolbar,
final unwarpJDialog dialog
) {
previousInstance = previousToolbar;
this.dialog = dialog;
instance = this;
final Container container = previousToolbar.getParent();
final Component[] component = container.getComponents();
for (int i = 0; (i < component.length); i++) {
if (component[i] == previousToolbar) {
container.remove(previousToolbar);
container.add(this, i);
break;
}
}
resetButtons();
down[currentTool] = true;
setTool(currentTool);
setForeground(evenDarker);
setBackground(gray);
addMouseListener(this);
container.validate();
}
示例3: PointToolbar
import ij.gui.Toolbar; //导入依赖的package包/类
/**
* Create an instance of PointToolbar.
*
* @param previousToolbar pointer to the previous toolbar in order to be able
* to restore it
* @param dialog pointer to the bUnwarpJ interface dialog
*/
public PointToolbar (
final Toolbar previousToolbar,
final MainDialog dialog)
{
this.previousInstance = previousToolbar;
this.dialog = dialog;
this.instance = this;
final Container container = previousToolbar.getParent();
final Component[] component = container.getComponents();
for (int i = 0; (i < component.length); i++) {
if (component[i] == previousToolbar) {
container.remove(previousToolbar);
container.add(this, i);
break;
}
}
resetButtons();
down[currentTool] = true;
setTool(currentTool);
setForeground(evenDarker);
setBackground(gray);
addMouseListener(this);
container.validate();
}
示例4: ToolbarPanel
import ij.gui.Toolbar; //导入依赖的package包/类
ToolbarPanel() {
setBackground(Color.white);
addMouseListener(this);
try {
drawButton = Toolbar.class.getDeclaredMethod("drawButton", Graphics.class, Integer.TYPE);
drawButton.setAccessible(true);
lineType = Toolbar.class.getDeclaredField("lineType");
lineType.setAccessible(true);
SIZE = Toolbar.class.getDeclaredField("SIZE");
SIZE.setAccessible(true);
OFFSET = Toolbar.class.getDeclaredField("OFFSET");
OFFSET.setAccessible(true);
size = ((Integer)SIZE.get(null)).intValue();
//offset = ((Integer)OFFSET.get(null)).intValue();
} catch (final Exception e) {
IJError.print(e);
}
// Magic cocktail:
final Dimension dim = new Dimension(250, size+size);
setMinimumSize(dim);
setPreferredSize(dim);
setMaximumSize(dim);
}
示例5: mousePressed
import ij.gui.Toolbar; //导入依赖的package包/类
@Override
public void mousePressed(final MouseEvent me) {
int x = me.getX();
int y = me.getY();
if (y > size) {
if (x > size * 7) return; // off limits
x += size * 9;
y -= size;
} else {
if (x > size * 9) return; // off limits
}
/*
if (Utils.isPopupTrigger(me)) {
if (x >= size && x <= size * 2 && y >= 0 && y <= size) {
showPopup("ovalPopup", x, y);
return;
} else if (x >= size * 4 && x <= size * 5 && y >= 0 && y <= size) {
showPopup("linePopup", x, y);
return;
}
}
*/
Toolbar.getInstance().mousePressed(new MouseEvent(toolbar, me.getID(), System.currentTimeMillis(), me.getModifiers(), x, y, me.getClickCount(), me.isPopupTrigger()));
repaint();
Display.toolChanged(ProjectToolbar.getToolId()); // should fire on its own but it does not (?) TODO
}
示例6: restoreAll
import ij.gui.Toolbar; //导入依赖的package包/类
/*********************************************************************
* Restore the regular listener interfaces,
* restore the regular ImageJ toolbar, stop
* the progress bar, and ask for garbage
* collection.
*
* @see turboRegDialog#cancelImages()
********************************************************************/
public void restoreAll()
{
cancelImages();
tb.restorePreviousToolbar();
Toolbar.getInstance().repaint();
turboRegProgressBar.resetProgressBar();
Runtime.getRuntime().gc();
}
示例7: setColor
import ij.gui.Toolbar; //导入依赖的package包/类
static void setColor(int red, int green, int blue, boolean foreground) {
if (red<0) red=0; if (green<0) green=0; if (blue<0) blue=0;
if (red>255) red=255; if (green>255) green=255; if (blue>255) blue=255;
Color c = new Color(red, green, blue);
if (foreground) {
Toolbar.setForegroundColor(c);
ImagePlus img = WindowManager.getCurrentImage();
if (img!=null)
img.getProcessor().setColor(c);
} else
Toolbar.setBackgroundColor(c);
}
示例8: restoreAll
import ij.gui.Toolbar; //导入依赖的package包/类
public void restoreAll (
) {
cancelSource();
cancelTarget();
tb.restorePreviousToolbar();
Toolbar.getInstance().repaint();
unwarpJProgressBar.resetProgressBar();
Runtime.getRuntime().gc();
}
示例9: restoreAll
import ij.gui.Toolbar; //导入依赖的package包/类
/**
* Restore the initial conditions.
*/
public void restoreAll ()
{
ungrayImage(sourcePh.getPointAction());
ungrayImage(targetPh.getPointAction());
cancelSource();
cancelTarget();
tb.restorePreviousToolbar();
Toolbar.getInstance().repaint();
ProgressBar.resetProgressBar();
Runtime.getRuntime().gc();
}
示例10: isRoiTool
import ij.gui.Toolbar; //导入依赖的package包/类
@Override
public boolean isRoiTool() {
final int tool = Toolbar.getToolId();
return tool == Toolbar.RECTANGLE || tool == Toolbar.OVAL ||
tool == Toolbar.POLYGON || tool == Toolbar.FREEROI ||
tool == Toolbar.LINE || tool == Toolbar.POLYLINE ||
tool == Toolbar.FREELINE || tool == Toolbar.POINT || tool == Toolbar.WAND;
}
示例11: installTool
import ij.gui.Toolbar; //导入依赖的package包/类
private void installTool()
{
StringBuilder sb = new StringBuilder();
sb.append("macro 'HSB Picker Tool - C00fT0610HC0f0T5910SCf00Tac10L' {\n");
sb.append(" call('").append(this.getClass().getName()).append(".run');\n");
sb.append("};\n");
new MacroInstaller().install(sb.toString());
Toolbar.getInstance().setTool(Toolbar.SPARE1);
}
示例12: installTool
import ij.gui.Toolbar; //导入依赖的package包/类
private void installTool()
{
String name = "Measure 3D Tool";
if (Toolbar.getInstance().getToolId(name) == -1)
{
StringBuilder sb = new StringBuilder();
sb.append("macro 'Measure 3D Tool - L0ef7F0d22Fe722C00fT06103T5610D' {\n");
sb.append(" call('").append(this.getClass().getName()).append(".run');\n");
sb.append("};\n");
new MacroInstaller().install(sb.toString());
}
Toolbar.getInstance().setTool(name);
}
示例13: addPluginTool
import ij.gui.Toolbar; //导入依赖的package包/类
/**
* Initialise the manual translocation finder tool. This is to allow support for calling within macro toolsets.
*/
public static void addPluginTool()
{
if (instance == null)
{
instance = new TranslocationFinder();
toolInstance = instance.new TranslocationFinderPluginTool();
}
// Add the tool
Toolbar.addPlugInTool(toolInstance);
IJ.showStatus("Added " + TITLE + " Tool");
}
示例14: addPluginTool
import ij.gui.Toolbar; //导入依赖的package包/类
/**
* Initialise the manual translocation finder tool. This is to allow support for calling within macro toolsets.
*/
public static void addPluginTool()
{
if (toolInstance == null)
{
toolInstance = new SpotPairDistancePluginTool();
}
// Add the tool
Toolbar.addPlugInTool(toolInstance);
IJ.showStatus("Added " + TITLE + " Tool");
}
示例15: showRoiDialog
import ij.gui.Toolbar; //导入依赖的package包/类
/**
* A dialog that requests the user to set a ROI. This ROI is used to create a
* reference image for the cross-correlation.
*
* @param title
* @return the selected slice of the stack or CANCEL
*/
private int showRoiDialog(final String title) {
IJ.setTool(Toolbar.RECTANGLE);
final ExtendedWaitForUserDialog dialog = new ExtendedWaitForUserDialog(
title + " - set ROI",
"Set a ROI to define the reference image.\nThe ROI should contain a structure visable at all images of the stack.",
null);
dialog.show();
if (dialog.escPressed() == false) return stack.getSlice();
return CANCEL;
}