public void run() { ij.gui.GUI.center(search_frame); search_frame.setVisible(true); } });
int getFontHeight() { Image img = GUI.createBlankImage(64, 64); //dummy version to get fontHeight Graphics g = img.getGraphics(); int fontType = boldText?Font.BOLD:Font.PLAIN; Font font = new Font("SansSerif", fontType, (int) (fontSize*zoom) ); FontMetrics metrics = g.getFontMetrics(font); return metrics.getHeight(); }
public static Rectangle getZeroBasedMaxBounds() { if (maxBounds==null) getMaxWindowBounds(); //if (IJ.debugMode) IJ.log("GUI.getZeroBasedMaxBounds: "+zeroBasedMaxBounds); return zeroBasedMaxBounds; }
public static Rectangle getMaxWindowBounds() { if (GraphicsEnvironment.isHeadless()) return new Rectangle(0,0,0,0); GraphicsEnvironment ge = GraphicsEnvironment.getLocalGraphicsEnvironment(); Rectangle bounds = ge.getMaximumWindowBounds(); if (IJ.isLinux() && unionOfBounds==null) unionOfBounds = getUnionOfBounds(ge); zeroBasedMaxBounds = null; if (bounds.x>300 || bounds.equals(unionOfBounds)) bounds = getZeroBasedMonitor(ge, bounds); if (bounds.x<0 || bounds.x>300 || bounds.width<300) { Dimension screen = getScreenSize(); bounds = new Rectangle(0, 0, screen.width, screen.height); } if (IJ.debugMode) IJ.log("GUI.getMaxWindowBounds: "+bounds); maxBounds = bounds; return bounds; }
public static Rectangle getMaxWindowBounds() { if (GraphicsEnvironment.isHeadless()) return new Rectangle(0,0,0,0); GraphicsEnvironment ge = GraphicsEnvironment.getLocalGraphicsEnvironment(); Rectangle bounds = ge.getMaximumWindowBounds(); if (IJ.isLinux() && unionOfBounds==null) unionOfBounds = getUnionOfBounds(ge); zeroBasedMaxBounds = null; if (bounds.x>300 || bounds.equals(unionOfBounds)) bounds = getZeroBasedMonitor(ge, bounds); if (bounds.x<0 || bounds.x>300 || bounds.width<300) { Dimension screen = getScreenSize(); bounds = new Rectangle(0, 0, screen.width, screen.height); } if (IJ.debugMode) IJ.log("GUI.getMaxWindowBounds: "+bounds); maxBounds = bounds; return bounds; }
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); }
int getFontHeight() { Image img = GUI.createBlankImage(64, 64); //dummy version to get fontHeight Graphics g = img.getGraphics(); int fontType = boldText?Font.BOLD:Font.PLAIN; Font font = new Font("SansSerif", fontType, (int) (fontSize*zoom) ); FontMetrics metrics = g.getFontMetrics(font); return metrics.getHeight(); }
public static Rectangle getUnionOfBounds() { if (unionOfBounds==null) getMaxWindowBounds(); return unionOfBounds; }
ij.gui.GUI.center(frame); frame.setVisible(true); }};
public ChannelColorCanvas(final ChannelColorChooser cColorChooser) { super(); this.cColorChooser = cColorChooser; setForeground(Color.black); setBackground(Color.white); cpWidth = cpRectWidth * cpNSats; cpHeight = cpRectHeight * cpNHues; canvasWidth = lutWidth + 2 + hSpacer + cpWidth + 2; canvasHeight = cpHeight + 2 + vSpacer + commonsHeight; setSize(canvasWidth, canvasHeight); // lutImage = new BufferedImage(lutWidth+2, lutHeight+2, BufferedImage.TYPE_INT_RGB); // colorPickerImage = new BufferedImage(cpWidth+2, cpHeight+2, BufferedImage.TYPE_INT_RGB); lutImage = GUI.createBlankImage(lutWidth + 2, lutHeight + 2); colorPickerImage = GUI.createBlankImage(cpWidth + 2, cpHeight + 2); // commonsImage = new BufferedImage(commonsWidth, commonsHeight, BufferedImage.TYPE_INT_RGB); drawLUT(); drawColorPicker(); // drawCommons(); addMouseListener(this); }
public static Rectangle getZeroBasedMaxBounds() { if (maxBounds==null) getMaxWindowBounds(); //if (IJ.debugMode) IJ.log("GUI.getZeroBasedMaxBounds: "+zeroBasedMaxBounds); return zeroBasedMaxBounds; }
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 ); }
private void doGraph() { if (flow instanceof FlowJFlow && trueFlow instanceof FlowJFlow) { ImagePlus imp = new ImagePlus("True-Estimate "+description, GUI.createBlankImage(300,300)); ImageWindow imw = new ImageWindow(imp); imp.show(); Image img = imp.getImage(); FlowJError.map(img.getGraphics(), 300, 300, flow, trueFlow); } else IJ.error("flow or true flow not known"); } /**
public static Rectangle getUnionOfBounds() { if (unionOfBounds==null) getMaxWindowBounds(); return unionOfBounds; }
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(); }}); }
Image img = GUI.createBlankImage(128, 64); Graphics g = img.getGraphics(); FontMetrics metrics = g.getFontMetrics(font);
/** Called once when ImageJ quits. */ public void savePreferences(Properties prefs) { Point loc = getLocation(); if (IJ.isLinux()) { Rectangle bounds = GUI.getMaxWindowBounds(); loc.y = bounds.y; } prefs.put(IJ_X, Integer.toString(loc.x)); prefs.put(IJ_Y, Integer.toString(loc.y)); }
@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); } }
Image img = GUI.createBlankImage(128, 64); Graphics g = img.getGraphics(); FontMetrics metrics = g.getFontMetrics(font);
/** Called once when ImageJ quits. */ public void savePreferences(Properties prefs) { Point loc = getLocation(); if (IJ.isLinux()) { Rectangle bounds = GUI.getMaxWindowBounds(); loc.y = bounds.y; } prefs.put(IJ_X, Integer.toString(loc.x)); prefs.put(IJ_Y, Integer.toString(loc.y)); }