开发者

Is there a JFrame.getBounds equivalent that gets only the actual client area?

开发者 https://www.devze.com 2023-03-31 07:40 出处:网络
Instead of the whole window c开发者_如何学Goomplete with close, maxi- and minimize buttons, as well as border?

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;
0

精彩评论

暂无评论...
验证码 换一张
取 消