Usable frame size and Windows Manager frame size

I'm setting a JFrame size with myFrame.setSize(Xsize,Ysize), but it gives me a problem : this doesn't define the usable space in the frame but the whole frame's size (it include the Windows Manager frame size, which isn't always the same). Is there any way to define the JFrame size by defining the usable space size ?

Answers


Usually the best method is to setPreferredSize() on the contents of the frame and then call pack().

If that is not possible then I think calling getInsets() on the Window will grab the size of the window manager frame as long as the frame is completely visible (you may need to use a listener and wait until a windowOpened() event). I haven't actually tried this on X but it definitely works on Windows. The downside of that approach is that the frame appears and then resizes. You could start it off screen and then move it to a visible location once you have the insets.


Need Your Help

Convert a SQL subquery into a join when looking at another record in the same table Access 2010

sql join subquery ms-access-2010

I have read that Joins are more efficient than subqueries, I have a query that is extremely slow and uses lots of subqueries, therefore I would like to improve it but do not know how.

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.