Login  Register

Re: Presentation and one question about OpenDialog boxes

Posted by Fernando Sales on Jan 30, 2008; 5:51pm
URL: http://imagej.273.s1.nabble.com/Presentation-and-one-question-about-OpenDialog-boxes-tp3697355p3697359.html

Michael,
It really works.
Thanks all for helping!

Fernando

On Jan 30, 2008 2:32 PM, Michael Schmid <[hidden email]> wrote:

> Hi Fernando,
>
> you specify the default directory (without a filename) as a
> path. If you want to see the dialog, the path should be null.
>
> Like this, the OpenDialog simply returns what you have put in:
> getDirectory() will give you the directory you have put in and
> getFileName() gives you an empty String because the filename
> was empty (it was just a directory without a filename)
>
> You should use
>    new OpenDialog("Select PRE-Interv. Frame", null);
>
> The dialogs that you have seen were created by ij.IJ.open()
> because it got an empty string.
>
> Michael
> ________________________________________________________________
>
>
> On 30 Jan 2008, at 18:05, Fernando Sales wrote:
>
> > Wayne and Michael,
> >
> > I've called a "new OpenDialog()" twice but, in the second time, the
> > title
> > wasn't updated and the method openDialog.getFileName() returned an
> > empty
> > String but the second image was opened correctly.
> > At the end, there is a piece of code which describes what i'm
> > talking about.
> > Thanks for helping!
> >
> > Fernando Sales
> >
> >
> > **********************************************************************
> > *******************
> >
> > import ij.*;
> > import ij.process.*;
> > import ij.io.OpenDialog;
> > import ij.plugin.*;
> > import java.util.*;
> >
> > public class VH_FrameAnalysis
> >     implements PlugIn {
> >   ImagePlus imps;
> >
> >   public void run(String args) {
> >
> >    OpenDialog preOpener = new OpenDialog("Select PRE-Interv. Frame",
> > OpenDialog.getLastDirectory());
> >    String preName = preOpener.getFileName();
> >    ij.IJ.open(preName);
> >
> >    preOpener = new OpenDialog("Select POST-Interv. Frame",
> > OpenDialog.getLastDirectory());
> >    System.out.println(preName);
> >    OpenDialog postOpener = new OpenDialog("Select POST-Interv. Frame",
> > OpenDialog.getLastDirectory());
> >    String postName = postOpener.getFileName();
> >    System.out.println(postName);
> >    ij.IJ.open(postName);
> >
> >  }
> >
> >   void showAbout() {
> >     IJ.showMessage("Teste");
> >   }
> > }
> >
> >
> >
> >
> >
> >
> > On Jan 30, 2008 6:38 AM, Michael Schmid <[hidden email]>
> > wrote:
> >
> >> Hi Fernando,
> >>
> >> maybe the path that you have specified is not null when you
> >> create your second OpenDialog?
> >> BTW, you can't *call* an OpenDialog for the second time, you
> >> have to create a new OpenDialog.
> >>
> >> Michael
> >> ________________________________________________________________
> >>
> >> On 29 Jan 2008, at 23:43, Fernando Sales wrote:
> >>
> >>> Hello everybody!
> >>>
> >>> I'm Fernando Sales, this is my first time on this mailing list.
> >>> Currently, i'm from Brazil and now, IJ has been used by me for
> >>> intravascular
> >>> ultrasound image processing.
> >>> I had some problem to use the OpenDialog class. More specifically,
> >>> i ued it
> >>> to open a file and store this file's name.
> >>> But when i've called the OpenDialog for the second time, i've
> >>> opened the
> >>> second file but i couldn't store the second file's name.
> >>> Is there any restritions for the use of OpenDialog boxes?
> >>>
> >>> See you,
> >>
>



--
**************************************************
Fernando José Ribeiro Sales
**************************************************
Email: [hidden email]
Tel: (11) 82020303
**************************************************