DocumentWindow with 1 pixel frame and 4 pixel resizable border


#1

Does anyone have a suggestion on how you get a DocumentWindow to have a 1 pixel frame size, but still keep the resizableBorder component a decent dimension? Overriding the getBorderThickness() function to return 1, results in the resizer being 1 pixel thick as well. That's just too thin to be user friendly - I can already hear the complaints.

I have the window configured like this:

setUsingNativeTitleBar( false );
setResizable( true, false );

I've implemented my own LookAndFeel methods (drawResizableFrame(), etc.); tried altering the opacity; replaced hitTest(); etc. and I can't seem to find the correct solution.

I feel like I'm overlooking something simple. Any help is appreciated. 

PS. Changing to the native title bar is something I want to avoid.


#2

Can you just create a LookAndFeel or subclass of ResizableBorderComponent that doesn't paint itself, and then overlay it over your window where you want it?


#3

I tried the LookAndFeel approach where my version of drawResizableFrame() did nothing. Which, I think would be equivalent to making a subclass of ResizableBorderComponent that doesn't paint itself. 

The fillResizableWindowBackground() then comes into play. So my version of that did nothing as well, and I called setOpaque( false ) in my DocumentWindow. With these changes, the resizable frame is now transparent, but it no longer responds to mouse over/click events. You also get a strange effect from the window's drop shadow that's sitting beyond the now invisible resizer.

I also tried adding my own ResizableBorderComponent and overlaying that on  top of the DocumentWindow. It worked in a manner of speaking, but the results were poor. There was a lot of jitter in the various child components. I'm sure I was breaking suggested practices with this approach.

All of the applications that I've looked at for reference seem to have the mouse change to the resizer cursor a fair distance from the application's window frame. It seems even beyond the drop shadow. Is this behaviour possible?


#4

If there's some jitter then you're probably doing something silly - when you have a normal non-native resizable window, then it also just uses the ResizableBorderComponent and works smoothly.

It's not really possible to add a resizable area outside the window except by using the OS to handle this. If you're in OSX then just let the window handle resizing natively and you'll be fine.