Is there a JFrame.getBounds equivalent that gets only the actual client area?
Instead of the whole window c开发者_如何学Goomplete with close, maxi- and minimize buttons, as well as border?
I'm trying to save a screenshot of the client area...maximizedBounds crashes the app...
Get the bounds of the content pane instead (i.e. JFrame.getContentPane().getBounds()
).
This did the trick:
Point pos = this.getContentPane().getLocationOnScreen();
Rectangle clientRect = this.getContentPane().getBounds();
clientRect.x = pos.x;
clientRect.y = pos.y;
精彩评论