preven title bar to show in the part of your rendering screen

when i add title bar to Jframe , my canvas for example lest say 400x400, it only shows 400 x 380, that bar is quiting space to the render screen, do you now how to fix that, i mean when i use title bar if my canvas is 400x400 to be like 400X420,
i think i can add more space, but i want to know if there is a direct/built in way.

thanks in advance.


Frame javadoc, 4th paragraph of the class description.

[quote]A frame may have its native decorations (i.e. Frame and Titlebar) turned off with setUndecorated. This can only be done while the frame is not displayable.

Look into Insets

You can propably make use of Window#pack
which causes the window to be sized to fit the preferred size and layouts of its subcomponents.

@Abuse, you should read the question :stuck_out_tongue:


Yep, the pack() function is the way to go. Also note that this will require you to set the sizes of your components in your window, and use appropriate layout managers.