Is there an equivalent to JFrame.getBounds that only gets the real client area?

Instead of the whole window complete with buttons for closing, maximum and minimum, as well as borders?

I am trying to save a screenshot of the client area ... maximizedBounds crashes the application ...

+4
source share
2 answers

Get the borders of the content area (i.e. JFrame.getContentPane().getBounds() ).

+6
source

This did the trick:

  Point pos = this.getContentPane().getLocationOnScreen(); Rectangle clientRect = this.getContentPane().getBounds(); clientRect.x = pos.x; clientRect.y = pos.y; 
+5
source

Source: https://habr.com/ru/post/1369522/


All Articles