本文整理了Java中ij.gui.GUI.center()
方法的一些代码示例,展示了GUI.center()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。GUI.center()
方法的具体详情如下:
包路径:ij.gui.GUI
类名称:GUI
方法名:center
[英]Positions the specified window in the center of the screen.
[中]将指定的窗口放置在屏幕中央。
代码示例来源:origin: sc.fiji/TrakEM2_
public void run() {
ij.gui.GUI.center(search_frame);
search_frame.setVisible(true);
}
});
代码示例来源:origin: sc.fiji/Simple_Neurite_Tracer
public GraphFrame(final JFreeChart chart, final String suggestedSuffix) {
super();
this.suggestedSuffix = suggestedSuffix;
mainPanel = new JPanel();
mainPanel.setLayout(new BorderLayout());
updateWithNewChart(chart, suggestedSuffix, true);
final JPanel buttonsPanel = new JPanel();
exportButton = new JButton("Export graph as SVG");
exportButton.addActionListener(this);
buttonsPanel.add(exportButton);
mainPanel.add(buttonsPanel, BorderLayout.SOUTH);
setContentPane(mainPanel);
validate();
setSize(new java.awt.Dimension(500, 270));
GUI.center(this);
}
代码示例来源:origin: net.preibisch/multiview-reconstruction
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 );
}
代码示例来源:origin: sc.fiji/TrakEM2_
Utils.invokeLater(new Runnable() { public void run() {
min_max.set(minslider.getValue(), maxslider.getValue());
frame.pack();
// after calling pack
Dimension dim = new Dimension(plot.getWidth(), 15);
minslider.setMinimumSize(dim);
maxslider.setMinimumSize(dim);
frame.pack(); // again
ij.gui.GUI.center(frame);
frame.setAlwaysOnTop(true);
frame.setVisible(true);
ContrastAdjustmentMode.super.initThreads();
}});
}
代码示例来源:origin: sc.fiji/3D_Viewer
@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"
+ "bene.schmid@gmail.com\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);
}
}
代码示例来源:origin: net.imagej/ij
public void buildTreePanel() {
pFrame=new JFrame(title);
pFrame.setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);
pTreeModel = new DefaultTreeModel(root);
pTree=new JTree(pTreeModel);
pTree.setEditable(false);
pTree.putClientProperty("JTree.lineStyle","Angled");
pTree.getSelectionModel().setSelectionMode(TreeSelectionModel.SINGLE_TREE_SELECTION);
pTree.setRootVisible(false);
pTree.setShowsRootHandles(true);
//pTree.setDragEnabled(true);
JScrollPane ptView=new JScrollPane(pTree);
addMenu();
pFrame.getContentPane().add(ptView, BorderLayout.CENTER);
addListeners();
pFrame.pack();
if (defaultLocation!=null) {
if (IJ.debugMode) IJ.log("CP.buildTreePanel: "+defaultLocation);
pFrame.setLocation(defaultLocation.x, defaultLocation.y);
} else
pcp.restoreGeometry(this);
//restoreExpandedNodes();
if (pFrame.getLocation().x==0)
GUI.center(pFrame);
setVisible();
ImageJ ij = IJ.getInstance();
ij.addWindowListener(this);
pFrame.addKeyListener(ij);
pTree.addKeyListener(ij);
}
代码示例来源:origin: imagej/ImageJA
public void buildTreePanel() {
pFrame=new JFrame(title);
pFrame.setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);
pTreeModel = new DefaultTreeModel(root);
pTree=new JTree(pTreeModel);
pTree.setEditable(false);
pTree.putClientProperty("JTree.lineStyle","Angled");
pTree.getSelectionModel().setSelectionMode(TreeSelectionModel.SINGLE_TREE_SELECTION);
pTree.setRootVisible(false);
pTree.setShowsRootHandles(true);
//pTree.setDragEnabled(true);
JScrollPane ptView=new JScrollPane(pTree);
addMenu();
pFrame.getContentPane().add(ptView, BorderLayout.CENTER);
addListeners();
pFrame.pack();
if (defaultLocation!=null) {
if (IJ.debugMode) IJ.log("CP.buildTreePanel: "+defaultLocation);
pFrame.setLocation(defaultLocation.x, defaultLocation.y);
} else
pcp.restoreGeometry(this);
//restoreExpandedNodes();
if (pFrame.getLocation().x==0)
GUI.center(pFrame);
setVisible();
ImageJ ij = IJ.getInstance();
ij.addWindowListener(this);
pFrame.addKeyListener(ij);
pTree.addKeyListener(ij);
}
代码示例来源:origin: sc.fiji/TrakEM2_
SwingUtilities.invokeLater(new Runnable() { @Override
public void run() {
final Display display = new Display(project, layer);
final Dimension screen = Toolkit.getDefaultToolkit().getScreenSize();
final Rectangle srcRect = new Rectangle(0, 0, (int)layer.getLayerWidth(), (int)layer.getLayerHeight());
double mag = screen.width / layer.getLayerWidth();
if (mag * layer.getLayerHeight() > screen.height) mag = screen.height / layer.getLayerHeight();
mag = display.canvas.getLowerZoomLevel2(mag);
if (mag > 1.0) mag = 1.0;
//display.getCanvas().setup(mag, srcRect); // would call pack() at the wrong time!
// ... so instead: manually
display.getCanvas().setMagnification(mag);
display.getCanvas().setSrcRect(srcRect.x, srcRect.y, srcRect.width, srcRect.height);
display.getCanvas().setDrawingSize((int)Math.ceil(srcRect.width * mag), (int)Math.ceil(srcRect.height * mag));
//
display.updateFrameTitle(layer);
ij.gui.GUI.center(display.frame);
display.frame.pack();
}});
}
代码示例来源:origin: net.imagej/ij
pack();
if (xloc==-1)
GUI.center(this);
else
setLocation(xloc, yloc);
代码示例来源:origin: imagej/ImageJA
pack();
if (xloc==-1)
GUI.center(this);
else
setLocation(xloc, yloc);
代码示例来源:origin: net.imagej/ij
setLocation(loc);
else
GUI.center(this);
setResizable(false);
show();
代码示例来源:origin: sc.fiji/VIB_
public ChoicesDialog(Frame parent, String title, String msg, String[] options) {
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.BOLD, 12));
panel.add(message);
add("North", panel);
panel = new Panel();
panel.setLayout(new FlowLayout(FlowLayout.RIGHT, 15, 8));
buttons = new Button[options.length];
chosen = new boolean[options.length];
for (int i=0;i<options.length;++i) {
buttons[i]=new Button(options[i]);
buttons[i].addActionListener(this);
panel.add(buttons[i]);
}
add("South", panel);
if (ij.IJ.isMacintosh())
setResizable(false);
pack();
GUI.center(this);
setVisible(true);
}
代码示例来源:origin: sc.fiji/3D_Viewer
@Override
public void run(final String ignore) {
final ImageStack stack = new ImageStack(3, 3);
for (int i = 0; i < 3; ++i) {
final byte[] pixels = new byte[9];
if (i == 1) pixels[4] = (byte) 255;
final ByteProcessor bp = new ByteProcessor(3, 3);
bp.setPixels(pixels);
stack.addSlice("", bp);
}
final ImagePlus i = new ImagePlus("test", stack);
i.show();
final Image3DUniverse univ = new Image3DUniverse(512, 512);
univ.show();
GUI.center(univ.getWindow());
final boolean[] channels = { true, true, true };
final Content c =
univ.addContent(i, new Color3f(Color.white),
"Volume Rendering of a Single Voxel at (1,1,1)", 10, // threshold
channels, 1, // resampling factor
ContentConstants.VOLUME);
final List<Point3f> linePoints = new ArrayList<Point3f>();
linePoints.add(new Point3f(1, 1, 1));
linePoints.add(new Point3f(2, 2, 2));
univ.addLineMesh(linePoints, new Color3f(Color.red),
"Line from (1,1,1) to (2,2,2)", false);
univ.resetView();
}
}
代码示例来源:origin: sc.fiji/MTrackJ_
GUI.center(this);
addWindowListener(this);
setResizable(true);
代码示例来源:origin: sc.fiji/MTrackJ_
dialoc.y = curwinloc.y;
setLocation(dialoc);
} else GUI.center(this);
} else {
if (lvp >= 0.5) {
dialoc.y = curwinloc.y;
setLocation(dialoc);
} else GUI.center(this);
代码示例来源:origin: sc.fiji/TrakEM2_
GUI.center(this);
if (show) setVisible(true);
代码示例来源:origin: sc.fiji/MTrackJ_
public void showDialog() {
yes = new Button(" Yes ");
yes.setFont(font);
yes.addActionListener(this);
yes.addKeyListener(this);
no = new Button(" No ");
no.setFont(font);
no.addActionListener(this);
no.addKeyListener(this);
Panel panel = new Panel();
panel.setLayout(new FlowLayout(FlowLayout.CENTER,0,0));
panel.add(yes);
panel.add(no);
add("Center",panel);
panel = new Panel();
panel.setLayout(new FlowLayout(FlowLayout.CENTER,0,5));
add("South",panel);
pack();
if (topleft != null) setLocation(topleft);
else GUI.center(this);
setResizable(true);
setVisible(true);
}
代码示例来源:origin: net.imagej/ij
setLocation(loc);
else
GUI.center(this);
show();
代码示例来源:origin: sc.fiji/RandomJ_
if (pos.x < 0 || pos.y < 0) GUI.center(dialog);
else dialog.setLocation(pos);
dialog.setVisible(true);
代码示例来源:origin: sc.fiji/TransformJ_
if (position.x < 0 || position.y < 0) GUI.center(dialog);
else dialog.setLocation(position);
dialog.setVisible(true);
内容来源于网络,如有侵权,请联系作者删除!