[ImageJ-devel] JHotDrawImageCanvas' +5 problem, was Re: Maven 3 support
Johannes Schindelin
Johannes.Schindelin at gmx.de
Tue Feb 28 17:23:11 CST 2012
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
More information about the ImageJ-devel
mailing list