[ImageJ-devel] JHotDrawImageCanvas' +5 problem, was Re: Maven 3 support

Curtis Rueden ctrueden at wisc.edu
Thu Mar 1 15:27:05 CST 2012


Hi Dscho,

However, JHotDrawImageCanvas actually contains a _JScrollPane_ whose
> JViewport contains the DrawingView. And I strongly suggest that that
> JViewport has insets, defaulting to (2,2,2,2) or some such.
>

I changed the hack to be +1 pixel from the scroll pane size, which should
hopefully be less sensitive to platform issues.

  http://trac.imagej.net/changeset/5011

But it's still a hack, and unlike your change does not do anything about
the menu bar.

-Curtis


On Tue, Feb 28, 2012 at 5:23 PM, Johannes Schindelin <
Johannes.Schindelin at gmx.de> wrote:

> Hi,
>
> On Tue, 28 Feb 2012, Curtis Rueden wrote:
>
> > > > The crappy scroll bars have been a continuing nuisance. I think it
> > > > may be a bug in JHotDraw.
> > >
> > > Heh, I thought so, too... See: http://trac.imagej.net/ticket/1025
> > >
> >
> > Does your fix eliminate the need for the "+5 pixels" hack then?
>
> I doubt it. My fix only triggers a re-layout after adding the menu bar (it
> does not even force an invalidation, so on Mac it actually does not change
> the layout at all).
>
> But let me try...
>
> *clicketyclick*
>
> Okay, it does not fix the problem.
>
> But reading the code, I have a hunch what is going wrong.
> JHotDrawImageCanvas overrides getPreferredSize() and returns the
> dimensions of the contained DrawingView's preferred size, enlarged by
> (5,5).
>
> However, JHotDrawImageCanvas actually contains a _JScrollPane_ whose
> JViewport contains the DrawingView. And I strongly suggest that that
> JViewport has insets, defaulting to (2,2,2,2) or some such.
>
> One thing that changes something is if I add this call just after
> instantiating the JScrollPane:
>
>        scrollPane.setBorder(new EmptyBorder(0, 0, 0, 0));
>
> Now I only need to add 1 per dimension...
>
> Leaving it as-is for now.
>
> Ciao,
> Dscho
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://imagej.net/pipermail/imagej-devel/attachments/20120301/743ab654/attachment.html>


More information about the ImageJ-devel mailing list