public void run() { ij.gui.GUI.center(search_frame); search_frame.setVisible(true); } });
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); }
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 ); }
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(); }}); }
@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); } }
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); }
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); }
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(); }}); }
pack(); if (xloc==-1) GUI.center(this); else setLocation(xloc, yloc);
pack(); if (xloc==-1) GUI.center(this); else setLocation(xloc, yloc);
setLocation(loc); else GUI.center(this); setResizable(false); show();
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); }
@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(); } }
GUI.center(this); addWindowListener(this); setResizable(true);
GUI.center(this); if (show) setVisible(true);
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); }
setLocation(loc); else GUI.center(this); show();
if (pos.x < 0 || pos.y < 0) GUI.center(dialog); else dialog.setLocation(pos); dialog.setVisible(true);
if (position.x < 0 || position.y < 0) GUI.center(dialog); else dialog.setLocation(position); dialog.setVisible(true);