NOTICE! This is a static HTML version of a legacy ImageJ Trac ticket.

The ImageJ project now uses GitHub Issues for issue tracking.

Please file all new issues there.

Ticket #496 (closed defect: fixed)

Opened 2011-05-04T11:15:58-05:00

Last modified 2011-05-10T17:11:00-05:00

Resize image panel at appropriate times

Reported by: bdezonia Owned by: bdezonia
Priority: major Milestone: biweekly-2011: May-09 to May-20
Component: UI Framework Version:
Severity: serious Keywords:
Cc: Blocked By:


Currently there a re a couple places where the panel is not getting resized when it would be good to do so:

  • crop
  • rotate 90 left or right
  • zoom to initial scale (this one has its own ticket)

Probably just need to call pack() at the appropriate time.

Change History

comment:1 Changed 2011-05-04T15:58:48-05:00 by bdezonia

I have some sketchy notes about a related discussion with Curtis from before. Not sure any of it is applicable anymore:

call pack() after setImage() and not before calculating window dims before 1st pack.

there is a race condition with pack() [I think Curtis solved this]. we use threads and we make SwingImageWindow without an image and call pack() and then later call setImage() which packs again via redoLayout(). Need to use SwingUtilities.invokeLater() or SwingUtilities.invokeAndWait() as appropriate.

comment:2 Changed 2011-05-04T16:01:11-05:00 by bdezonia

more old discussion:

all images on my machine - initial display window wrong size. [again I think this is fixed] On the event dispatch thread we need to publish an event via SwingUtils.invokeLater().

comment:3 Changed 2011-05-10T17:08:10-05:00 by bdezonia

  • Status changed from new to closed
  • Resolution set to fixed

mostly fixed the problem where the display window would not resize when various operations were performed (rotate 90, crop). what is left is being filed as a ticket. note that this fix causes zoom and pan of the current image to be reset to (0,0) and 1X after a Dataset restructure event. window title and label reflect the new dimensions and zoom levels.

comment:4 Changed 2011-05-10T17:10:40-05:00 by bdezonia

Note that there was some special case code added to SwingImageDisplay to support this. It listens for DatsetStructuredEvents and repacks the image window in such a case. A code review of the tail of the update() method would be appreciated.

comment:5 Changed 2011-05-10T17:11:00-05:00 by bdezonia

  • Milestone changed from biweekly-2011: Apr-25 to May-06 to biweekly-2011: May-09 to May-20