Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

JFrame : Getting actual content size

I have created a JFrame, and attempting to get it's size is giving an incorrect result, compared to what I expect.

I have determined that it is including the operating system borders around the edges, and the title bar.

How can I get/set the real size which I have available for rendering?

like image 342
Ashley Davies Avatar asked Aug 22 '11 23:08

Ashley Davies


1 Answers

The size you are getting is the size of the content and the size of the insets. If you use Jcomponent.getInsets(), you can find the size of the content with simple subtraction.

like image 90
Jeffrey Avatar answered Sep 22 '22 07:09

Jeffrey