P
Peter Duniho
Reading several different web sites, include the Java forums on Sun's web
site, I see messages suggesting this is hopeless. But I figured before I
resigned myself to flickering while resizing my JFrame with the mouse, I
should check here.
First, the solution offered on these various web sites all match the one I
came up with: using a component listener, handling componentResized(),
check the new size and reset it to the minimum size if the new size is too
small in either dimension.
I wish I could depend on setMinimumSize() to deal with this for me, as
native APIs allow, but when I tried that it had no effect on mouse
dragging. Only on programmatic changes to the frame's size.
Using the component listener method technique, then any time the new size
gets reset back to the minimum size, the frame flickers. So, resizing the
frame as long as you're at least the minimum size is fine (since the
JFrame is double-buffered by default, there's normally no flicker), but
once you get one of the dimensions to the minimum size then any mouse
movements cause the frame to flicker as it resizes.
I'm hoping someone can tell me that I'm using an archaic way to prevent
the frame from being dragged below its minimum size, and that there's a
new, better way to do it that has the added benefit of not causing the
frame to flicker when a minimum dimension is reached.
Thanks!
Pete
site, I see messages suggesting this is hopeless. But I figured before I
resigned myself to flickering while resizing my JFrame with the mouse, I
should check here.
First, the solution offered on these various web sites all match the one I
came up with: using a component listener, handling componentResized(),
check the new size and reset it to the minimum size if the new size is too
small in either dimension.
I wish I could depend on setMinimumSize() to deal with this for me, as
native APIs allow, but when I tried that it had no effect on mouse
dragging. Only on programmatic changes to the frame's size.
Using the component listener method technique, then any time the new size
gets reset back to the minimum size, the frame flickers. So, resizing the
frame as long as you're at least the minimum size is fine (since the
JFrame is double-buffered by default, there's normally no flicker), but
once you get one of the dimensions to the minimum size then any mouse
movements cause the frame to flicker as it resizes.
I'm hoping someone can tell me that I'm using an archaic way to prevent
the frame from being dragged below its minimum size, and that there's a
new, better way to do it that has the added benefit of not causing the
frame to flicker when a minimum dimension is reached.
Thanks!
Pete