本文整理汇总了Java中ij.gui.GUI类的典型用法代码示例。如果您正苦于以下问题:Java GUI类的具体用法?Java GUI怎么用?Java GUI使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
GUI类属于ij.gui包,在下文中一共展示了GUI类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: showDialog
import ij.gui.GUI; //导入依赖的package包/类
public void showDialog()
{
// Detect if running in a macro and just collect the input options
if (macro)
{
dispose();
}
else
{
add(buildPanels());
this.addKeyListener(this);
if (IJ.isMacintosh())
setResizable(false);
pack();
GUI.center(this);
setVisible(true);
IJ.wait(50); // work around for Sun/WinNT bug
}
}
示例2: GraphFrame
import ij.gui.GUI; //导入依赖的package包/类
public GraphFrame(
final TimePoints timepoints,
final JFreeChart chart,
final int referenceTimePoint,
final boolean enableReferenceTimePoint,
final List< SelectTimepointEntry > extraMenuItems,
final ArrayList< RegistrationStatistics > data )
{
super();
mainPanel = new JPanel();
mainPanel.setLayout( new BorderLayout() );
updateWithNewChart( timepoints, chart, true, extraMenuItems, data, referenceTimePoint, enableReferenceTimePoint );
JPanel buttonsPanel = new JPanel();
mainPanel.add( buttonsPanel, BorderLayout.SOUTH );
setContentPane( mainPanel );
validate();
GUI.center( this );
}
示例3: GraphFrame
import ij.gui.GUI; //导入依赖的package包/类
public GraphFrame( final JFreeChart chart, final int referenceTimePoint, final boolean enableReferenceTimePoint, final List<FileOpenMenuEntry> extraMenuItems, final ArrayList< RegistrationStatistics > data )
{
super();
this.referenceTimePoint = referenceTimePoint;
this.enableReferenceTimePoint = enableReferenceTimePoint;
mainPanel = new JPanel();
mainPanel.setLayout( new BorderLayout() );
updateWithNewChart( chart, true, extraMenuItems, data );
JPanel buttonsPanel = new JPanel();
mainPanel.add( buttonsPanel, BorderLayout.SOUTH );
setContentPane( mainPanel );
validate();
GUI.center( this );
}
示例4: renderPathsIn3DViewer
import ij.gui.GUI; //导入依赖的package包/类
private synchronized void renderPathsIn3DViewer(final int choice, final boolean reuseLastViewer) {
final int nViewers = Image3DUniverse.universes.size();
boolean reusingViewer = false;
if (reuseLastViewer && nViewers > 0) {
univ = Image3DUniverse.universes.get(nViewers - 1);
reusingViewer = univ != null;
}
if (!reusingViewer) {
univ = createNewUniverse();
}
switch (choice) {
case GRAY_3DVIEWER:
renderPathsIn3DViewer(DEFAULT_DESELECTED_COLOR, univ);
break;
case COLOR_3DVIEWER:
renderPathsIn3DViewer(DEFAULT_DESELECTED_COLOR, univ);
break;
case COLORMAP_3DVIEWER:
renderPathsIn3DViewer(choice, univ);
break;
default:
throw new RuntimeException("BUG: Choice for 3D rendering was not understood");
}
if (!reusingViewer) {
univ.show();
final ImageWindow3D window = univ.getWindow();
if (chosenFile != null)
window.setTitle(chosenFile.getName());
GUI.center(window);
}
}
示例5: run
import ij.gui.GUI; //导入依赖的package包/类
@Override
public void run(final String arg) {
if (view == null) {
view = new RegionGrowingView();
dialog = new JDialog((Frame) null, TITLE, false);
dialog.setIconImage(UIUtils.getImageJIconImage());
dialog.getContentPane().add(view);
dialog.pack();
dialog.setLocationRelativeTo(null);
dialog.setDefaultCloseOperation(WindowConstants.HIDE_ON_CLOSE);
// Add listener to store window location and size on close
dialog.addWindowListener(new WindowAdapter() {
@Override
public void windowClosing(final WindowEvent e) {
super.windowClosing(e);
Prefs.saveLocation(LOC_KEY, dialog.getLocation());
final Dimension d = dialog.getSize();
Prefs.set(WIDTH_KEY, d.width);
Prefs.set(HEIGHT_KEY, d.height);
}
});
// Restore location and size
final Point loc = Prefs.getLocation(LOC_KEY);
final int w = (int) Prefs.get(WIDTH_KEY, 0.0);
final int h = (int) Prefs.get(HEIGHT_KEY, 0.0);
if (loc != null && w > 0 && h > 0) {
dialog.setSize(w, h);
dialog.setLocation(loc);
} else {
// setSize(width, height);
GUI.center(dialog);
}
}
dialog.setVisible(true);
}
示例6: run
import ij.gui.GUI; //导入依赖的package包/类
public void run (
final String commandLine
) {
String options = Macro.getOptions();
if (!commandLine.equals("")) options = commandLine;
if (options == null) {
Runtime.getRuntime().gc();
final ImagePlus[] imageList = createImageList();
if (imageList.length < 2) {
IJ.error("At least two images are required (stack of color images disallowed)");
return;
}
final unwarpJDialog dialog = new unwarpJDialog(IJ.getInstance(), imageList);
GUI.center(dialog);
dialog.setVisible(true);
} else {
final String[] args = getTokens(options);
if (args.length<1) {
dumpSyntax();
return;
} else {
if (args[0].equals("-help")) dumpSyntax();
else if (args[0].equals("-align")) alignImagesMacro(args);
else if (args[0].equals("-transform")) transformImageMacro(args);
}
return;
}
}
示例7: run
import ij.gui.GUI; //导入依赖的package包/类
@Override
public void run(final String arg) {
final ImagePlus image = WindowManager.getCurrentImage();
try {
final Image3DUniverse univ = new Image3DUniverse();
univ.show();
GUI.center(univ.getWindow());
if (arg != null && !arg.equals("")) importContent(arg);
// only when there is an image and we are not called
// from a macro
else if (image != null && !IJ.isMacro()) univ.getExecuter().addContent(
image, null);
}
catch (final Exception e) {
final StringBuffer buf = new StringBuffer();
final StackTraceElement[] st = e.getStackTrace();
buf.append("An unexpected exception occurred. \n"
+ "Please mail me the following lines if you \n" + "need help.\n"
+ "[email protected]\n \n");
buf.append(e.getClass().getName() + ":" + e.getMessage() + "\n");
for (int i = 0; i < st.length; i++) {
buf.append(" at " + st[i].getClassName() + "." +
st[i].getMethodName() + "(" + st[i].getFileName() + ":" +
st[i].getLineNumber() + ")\n");
}
new ij.text.TextWindow("Error", buf.toString(), 500, 400);
}
}
示例8: SMLMTools
import ij.gui.GUI; //导入依赖的package包/类
/**
* Constructor.
* <p>
* Create a frame showing all the available plugins within the user [ImageJ]/plugins/smlm.config file or the default
* gdsc/smlm/plugins.config file.
*/
public SMLMTools()
{
super(TITLE);
// Only allow one instance to run
if (isFrameVisible())
{
if (!(instance.getTitle().equals(getTitle())))
{
closeFrame();
}
else
{
instance.toFront();
return;
}
}
if (!createFrame())
return;
instance = this;
WindowManager.addWindow(this);
pack();
Point loc = Prefs.getLocation(OPT_LOCATION);
if (loc != null)
setLocation(loc);
else
{
GUI.center(this);
}
if (IJ.isMacOSX())
setResizable(false);
setVisible(true);
}
示例9: run
import ij.gui.GUI; //导入依赖的package包/类
public void run(String arg) {
if (!FJ.libcheck()) return;
FJ.log(FJ.name()+" "+FJ.version()+": Panel");
final Frame parent = (IJ.getInstance() != null) ? IJ.getInstance() : new Frame();
dialog = new Dialog(parent,FJ.name(),false);
dialog.setLayout(new FlowLayout());
dialog.addWindowListener(this);
panel = new Panel();
panel.setLayout(new GridLayout(3,3,5,5));
derivatives = addButton("Derivatives");
edges = addButton("Edges");
hessian = addButton("Hessian");
laplacian = addButton("Laplacian");
statistics = addButton("Statistics");
structure = addButton("Structure");
about = addButton("About");
options = addButton("Options");
website = addButton("Website");
dialog.add(panel);
dialog.pack();
if (pos.x < 0 || pos.y < 0) GUI.center(dialog);
else dialog.setLocation(pos);
dialog.setVisible(true);
}
示例10: run
import ij.gui.GUI; //导入依赖的package包/类
public void run(String arg)
{
UsageTracker.recordPlugin(this.getClass(), arg);
if (WindowManager.getImageCount() == 0)
{
IJ.showMessage("No images opened.");
return;
}
if (instance != null)
{
instance.toFront();
return;
}
instance = this;
IJ.register(Stack_Synchroniser.class);
WindowManager.addWindow(this);
// Register to be notified of image changes
ImagePlus.addImageListener(this);
createFrame();
fillImagesList();
addKeyListener(IJ.getInstance());
pack();
Point loc = Prefs.getLocation(OPT_LOCATION);
if (loc != null)
setLocation(loc);
else
{
GUI.center(this);
}
setVisible(true);
}
示例11: YesNoDialog
import ij.gui.GUI; //导入依赖的package包/类
public YesNoDialog(Frame parent, String title, String msg, boolean show) {
super(parent, title, true);
setLayout(new BorderLayout());
Panel panel = new Panel();
panel.setLayout(new FlowLayout(FlowLayout.LEFT, 10, 10));
MultiLineLabel message = new MultiLineLabel(msg);
message.setFont(new Font("Dialog", Font.PLAIN, 12));
panel.add(message);
add("North", panel);
panel = new Panel();
panel.setLayout(new FlowLayout(FlowLayout.RIGHT, 15, 8));
if (IJ.isMacintosh() && msg.startsWith("Save")) {
yesB = new Button(" Save ");
noB = new Button("Don't Save");
} else {
yesB = new Button(" Yes ");
noB = new Button(" No ");
}
yesB.addActionListener(this);
noB.addActionListener(this);
yesB.addKeyListener(this);
noB.addKeyListener(this);
if (IJ.isMacintosh()) {
panel.add(noB);
panel.add(yesB);
setResizable(false);
} else {
panel.add(yesB);
panel.add(noB);
}
add("South", panel);
pack();
GUI.center(this);
if (show) setVisible(true);
}
示例12: actionPerformed
import ij.gui.GUI; //导入依赖的package包/类
public void actionPerformed (
final ActionEvent ae
) {
if (ae.getActionCommand().equals("Cancel")) {
dispose();
restoreAll();
}
else if (ae.getActionCommand().equals("Done")) {
dispose();
joinThreads();
imagePyramidDepth = max_scale_deformation-min_scale_deformation+1;
divWeight = Double.valueOf(divWeightTextField.getText()).doubleValue();
curlWeight = Double.valueOf(curlWeightTextField.getText()).doubleValue();
landmarkWeight = Double.valueOf(landmarkWeightTextField.getText()).doubleValue();
imageWeight = Double.valueOf(imageWeightTextField.getText()).doubleValue();
//richOutput = ckRichOutput.getState();
richOutput = false;
saveTransformation = ckSaveTransformation.getState();
int outputLevel=1;
boolean showMarquardtOptim=false;
if (richOutput) {
outputLevel++;
showMarquardtOptim=true;
}
unwarpJFinalAction finalAction =
new unwarpJFinalAction(this);
finalAction.setup(sourceImp,targetImp,
source, target, sourcePh, targetPh,
sourceMsk, targetMsk, min_scale_deformation, max_scale_deformation,
min_scale_image, divWeight, curlWeight, landmarkWeight, imageWeight,
stopThreshold, outputLevel, showMarquardtOptim, mode);
finalActionLaunched=true;
tb.setAllUp(); tb.repaint();
finalAction.getThread().start();
}
else if (ae.getActionCommand().equals("Credits...")) {
final unwarpJCredits dialog = new unwarpJCredits(IJ.getInstance());
GUI.center(dialog);
dialog.setVisible(true);
} else if (ae.getActionCommand().equals("Advanced Options")) {
advanced_dlg.setVisible(true);
} else if (ae.getActionCommand().equals("Done")) {
advanced_dlg.setVisible(false);
}
}
示例13: mousePressed
import ij.gui.GUI; //导入依赖的package包/类
public void mousePressed (
final MouseEvent e
) {
final int x = e.getX();
final int y = e.getY();
int newTool = 0;
for (int i = 0; (i < NUM_TOOLS); i++) {
if (((i * SIZE) < x) && (x < (i * SIZE + SIZE))) {
newTool = i;
}
}
boolean doubleClick = ((newTool == getCurrentTool())
&& ((System.currentTimeMillis() - mouseDownTime) <= 500L)
&& (newTool == unwarpJPointAction.REMOVE_CROSS));
mouseDownTime = System.currentTimeMillis();
if (newTool==unwarpJPointAction.STOP && !dialog.isFinalActionLaunched())
return;
if (newTool!=unwarpJPointAction.STOP && dialog.isFinalActionLaunched())
return;
setTool(newTool);
if (doubleClick) {
unwarpJClearAll clearAllDialog = new unwarpJClearAll(IJ.getInstance(),
sourceImp, targetImp, sourcePh, targetPh);
GUI.center(clearAllDialog);
clearAllDialog.setVisible(true);
setTool(unwarpJPointAction.ADD_CROSS);
clearAllDialog.dispose();
}
switch (newTool) {
case unwarpJPointAction.FILE:
unwarpJFile fileDialog = new unwarpJFile(IJ.getInstance(),
sourceImp, targetImp, sourcePh, targetPh,dialog);
GUI.center(fileDialog);
fileDialog.setVisible(true);
setTool(unwarpJPointAction.ADD_CROSS);
fileDialog.dispose();
break;
case unwarpJPointAction.MASK:
case unwarpJPointAction.INVERTMASK:
dialog.setClearMask(true);
break;
case unwarpJPointAction.STOP:
dialog.setStopRegistration();
break;
}
}
示例14: mousePressed
import ij.gui.GUI; //导入依赖的package包/类
/**
* Mouse pressed, applied to select the tool.
*
* @param e mouse event
*/
public void mousePressed (final MouseEvent e)
{
final int x = e.getX();
//final int y = e.getY();
int newTool = 0;
for (int i = 0; (i < NUM_TOOLS); i++)
{
if (((i * SIZE) < x) && (x < (i * SIZE + SIZE)))
{
newTool = i;
}
}
boolean doubleClick = ((newTool == getCurrentTool())
&& ((System.currentTimeMillis() - mouseDownTime) <= 500L)
&& (newTool == PointAction.REMOVE_CROSS));
mouseDownTime = System.currentTimeMillis();
if (newTool == PointAction.STOP && !dialog.isFinalActionLaunched())
return;
if (newTool!=PointAction.STOP && dialog.isFinalActionLaunched())
return;
setTool(newTool);
if (doubleClick)
{
ClearAll clearAllDialog = new ClearAll(IJ.getInstance(), sourcePh, targetPh);
GUI.center(clearAllDialog);
clearAllDialog.setVisible(true);
setTool(PointAction.ADD_CROSS);
clearAllDialog.dispose();
}
switch (newTool)
{
case PointAction.FILE:
IODialog fileDialog = new IODialog(IJ.getInstance(),
sourceImp, targetImp, sourcePh, targetPh,dialog);
GUI.center(fileDialog);
fileDialog.setVisible(true);
setTool(PointAction.ADD_CROSS);
fileDialog.dispose();
break;
case PointAction.MASK:
case PointAction.INVERTMASK:
dialog.setClearMask(true);
break;
case PointAction.STOP:
dialog.setStopRegistration();
break;
}
}
示例15: run
import ij.gui.GUI; //导入依赖的package包/类
public void run(String arg)
{
SMLMUsageTracker.recordPlugin(this.getClass(), arg);
if (WindowManager.getImageCount() == 0)
{
IJ.showMessage(TITLE, "No images opened.");
return;
}
if ("add".equals(arg))
{
if (instance != null)
((SpotAnalysis) instance).addFrame();
return;
}
if (instance != null)
{
instance.toFront();
return;
}
instance = this;
IJ.register(SpotAnalysis.class);
WindowManager.addWindow(this);
ImagePlus.addImageListener(this);
//ij = IJ.getInstance();
createFrame();
setup();
//addKeyListener(ij);
addKeyListener(this);
pack();
Point loc = Prefs.getLocation(OPT_LOCATION);
if (loc != null)
setLocation(loc);
else
{
GUI.center(this);
}
if (IJ.isMacOSX())
setResizable(false);
setVisible(true);
// Install shortcut for adding a slice
String command = "Spot Analysis (Add)";
String shortcut = "6";
String plugin = "ij.plugin.Hotkeys(" + "\"" + command + "\")";
Menus.installPlugin(plugin, Menus.SHORTCUTS_MENU, "*" + command, shortcut, IJ.getInstance());
}