Login  Register

Re: ImagePlus Window inside JFrame

Posted by Juanjo Vega on Aug 09, 2011; 10:12am
URL: http://imagej.273.s1.nabble.com/ImagePlus-Window-inside-JFrame-tp3683566p3683567.html

You can place an ImageCanvas inside a JFrame, but you'll loose ImageJ functionality:

    public static void main(String args[]) {
        String file = "path-to-file";

        ImagePlus imp = IJ.openImage(file);
        ImageCanvas ic = new ImageCanvas(imp);
        JFrame frame = new JFrame("TEST");
        frame.add(ic);

        frame.pack();
        frame.setLocationRelativeTo(null);
        frame.setVisible(true);
    }

Why do you want to use a JFrame?


On Aug 9, 2011, at 11:10 AM, ashamim wrote:

> Hello Everyone
>
> Is it possible to display the ImagePlus window inside Jframe. I couldnt find
> out a way of displaying it in such away that it can even be cropped from
> there. So far i am display the buffered image inside the frame but when i
> have to crop the image i have to open it up again in imageJ window.
>
> Thanks in advance
>
> Ahsan
>
> -----
> Ahsan
> --
> View this message in context: http://imagej.588099.n2.nabble.com/ImagePlus-Window-inside-JFrame-tp6667443p6667443.html
> Sent from the ImageJ mailing list archive at Nabble.com.

------------------------------------------------------------
Juanjo Vega ([hidden email])

Unidad de Biocomputación. Laboratorio B-13.
Centro Nacional de Biotecnología. CNB-CSIC.
C\ Darwin, 3. Campus de Cantoblanco.
Universidad Autónoma de Madrid.
28049, Madrid, Spain.

http://www.cnb.csic.es
http://www.biocomp.cnb.csic.es

+34 91 585 4510

"Las mejores almas son capaces de los mayores vicios como de las mayores
virtudes, y aquellos que caminan despacio por el camino recto pueden
llegar más lejos que los que corren pero se apartan de él." - Discurso
del Método, René Descartes.