minor UI bug?

Posted by Kenneth Sloan-2 on
URL: http://imagej.273.s1.nabble.com/minor-UI-bug-tp5023271.html

In today's Java plugin, I decided to be extra nice, and ran into a minor problem that I don't quite understand.

Context: Mac, latest OSX, up-to-date FIJI

I have a couple of Dialog boxes which appear repeatedly.  I have them placed in a location that makes sense to me, on my machine - but it occurred to me that some users might prefer to move them (different resolution screens, different preferences as to where the dialogs should appear, etc.)

So, I tried this:


NonBlockingGenericDialog gd;
int gdLocationX = defaultX;
int gdLocationX = defaultY;
while(true)
{
  gd = new NonBlockingGenericDialog(...);
  ...  add fields to gd ...
  gd.setLocation(gdLocationX, gdLocationY); // put it where we want it
  gd.showDialog();
  // find out where it is now
  gdLocationX = gd.getLocation().x;  // getLocation returns a Point
  gdLocationX = gd.getLocation().y;
  ...process results from the dialog...
}

Which works perfectly, EXCEPT that the  dialog box creeps slowly up the screen.  The x-coordinate remains constant, but the y-coordinate gets smaller and smaller...until it reaches the top of the screen, where (mercifully) it stops.

Experimentation reveals that (on my machine, today...) the upward creep is 21 (I think that's correct) pixels, which appears to be the height of the banner added to the top of the dialog.

I "fixed" it with:

  gdLocationX = gd.getLocation().y  + 21; // hack alert!

but this seems unprincipled.  

Does anyone know how to determine the size of the banner added to the dialog window (I suspect it differs on other platforms)?   This may require  java.awt knowledge rather than ImageJ knowledge - the getLocation() method is inherited from java.awt.Component.

I'm also confused, because there is a (very small) frame surrounding the dialog box horizontally,< but the x-coordinate does not change over time - it is perfectly stable).

Is it reasonable to request a fix to ImageJ to correct for this "drift"?

Clearly, I have too much time on my hands, and am woefully ignorant of java.awt internals.

--
Kenneth Sloan
[hidden email]
Vision is the art of seeing what is invisible to others.

--
ImageJ mailing list: http://imagej.nih.gov/ij/list.html