http://imagej.273.s1.nabble.com/Changing-location-of-a-generic-dialog-tp3694061p3694065.html
We're straying off topic, but it boils down to avoiding a project fork. The
> since imagej is open source, why not just comment out the
> offending call that centers the dialog when you display it?
> so that code that does something like this:
>
> 1. create dialog
> 2. set its location
> 3. display it
>
> actually works?
>
> / eitan
>
> On Tue, Jan 13, 2009 at 1:15 PM, Albert Cardona
> <
[hidden email]>wrote:
>
> > Jon Harman wrote:
> >
> >> Hi,
> >> My plugin uses a generic dialog, but it pops up in an inconvenient
> place.
> >> Is there any way I can change the location? Maybe somehow place it the
> >> second time in the same place the user moved it?
> >>
> >
> >
> > Make the class that launches the dialog store the dialog's X,Y position
> in
> > the screen. You can get such position by:
> >
> > GenericDialog gd = ....
> > Point loc = gd.getLocation();
> >
> >
> > The ideal position to get such coordinates is in a ComponentListener:
> >
> > gd.addComponent(new ComponentAdapter() {
> > public void componentMoved(ComponentEvent ce) {
> > Point loc = ce.getComponent().getLocation();
> > // ... store loc somewhere
> > }
> > });
> >
> >
> > Then, whenever the dialog is opened, set its position (only if any
> position
> > recorded):
> >
> > GenericDialog gd = ....
> > if (null != loc) {
> > gd.setLocation(loc.x, loc.y);
> > }
> >
> > The risk above is that the location may be off screen (i.e. if the user
> > disconnected an extra monitor). You can check that too, using the
> > GraphicsConfiguration and GraphicsDevice methods.
> >
> >
> > If the instance of the class that launched the dialog is destroyed, you
> can
> > store the "loc" in a static field.
> >
> > Albert
> >
> > --
> > Albert Cardona
> >
http://albert.rierol.net> >
>