JFrame dimensions?

I want my next game to have a re sizable window (no external libraries used)

How do I get the size of the interior of the JFrame?
What I mean is, I can get the total width/height of the JFrame “frame” via “frame.getWidth()”

The problem is that I set the size of the frame to be 640 x 480, but when I get the dimensions via the method above, I get 646 x 509.

I can only imagine that the numbers get bigger because of the size of the border of the window.

But I don’t want those dimensions, I want the dimensions of what I’m actually drawing on.

I know I could just subtract 6 and 29, but that won’t work for every OS.

So how can I get the dimensions I’m looking for?

Thanks.