> It would be possible to visually reproduce the look of Safari 4
> beta. There is one show stopper, however, for Java apps on the Mac:
> when you implement your own resizing mechanism (i.e. you call
> myFrame.setSize(...) in response to some event) there is a terrible
> flicker. This is why my HUD component in Mac Widgets for Java is
> currently not resizable. Hopefully this will get fixed soon.
>
> -Ken
Hi again Ken,
I feel I'm polluting your message board with off-topic posts, so I'll
switch to email mode.
I've seen the problem with the flicker, but haven't looked much into
it yet. To be honest, I haven't even been able to smoothly *move* a
window (needed for a proper unified toolbar). Do you have a way? ;-)
The idea is that the pixel in the window, under the cursor should
stick exactly (like it does when you drag the title bar). I'm able to
move the window using mouse motion listeners, or even tracking the
mouse directly. But in any case, it seems like the Swing (or AWT)
setLocation (and others) end up with an invocation of reshape(x, y, w,
h)... And because of window listeners, native calls, etc (probably
more magic I don't know), the window will allways lag behind a few
pixels.
The only way I have found is to make the entire window draggable
(apple.awt.draggableWindowBackground), but that's also not usable with
Swing, as only heavy-weight components will prevent drag...
Best regards,
--
Harald K
The problem isn't so much to make the window draggable, that is fairly
simple. I started out with your approcah, but rewrote to something
that tracks the mouse directly because it seems to be smoother. Might
change that again.
Anyway, I think you'll find that moving the window using the "real"
titlebar is smooth, uses almost no CPU, and keeps the mouse position
relative to the window constant. Doing it with Swing will make the
window lag behind the mouse pointer, and the CPU usage go up
significantly. It even seems that the more complex components you
have, the more CPU it uses (and the more it lags behind) making me
believe that painting is going on for each setLocation...
--
Harald K
Best regards,
--
Harald K