Solved

setting JFrame LayoutManager to NORTH

Posted on 2007-04-09
1
307 Views
Last Modified: 2013-11-23
Hi, experts:

This is going to sound really dumb.  I have some old code that looks like this:

               JFrme outer = new JFram(BorderLayout.NORTH);

This is the stupid part.  I already have a JFrame called outer.  Now all I want to do is set its BorderLayout to NORTH.  I don't want to put any buttons on it or anything.  It is meant to be an MDI.  I cannot find any information anywhere that allows me to set it to NORTH without putting a button it.

FRUSTRATED!

P.S. Thanks for your help.
0
Comment
Question by:pdlarue
1 Comment
 
LVL 3

Accepted Solution

by:
RizwanKhalid earned 50 total points
ID: 18887941
You can only set the layouts of panels and not frames. Every frame has a deafult rootpane, that is hidden from the user in such a way that if you set the borderlayout (or any layout) of the frame, it will set the layout of this rootpane. Now if you make a JFrame an MDI or do not put any controls on the frame, then it does not have any rootpane. So if you set it layout to anything it will not do it as it does not have the rootpane. That is why it requires to have at least one control before it allows to set layouts.

Hope this helps.
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Need Tool Easily Convert Text to a quote string 5 29
error when i compile 5 574
passing a variable to eclipse to debug 2 66
Java eclipse error 2 66
Update (December 2011): Since this article was published, the things have changed for good for Android native developers. The Sequoyah Project (http://www.eclipse.org/sequoyah/) automates most of the tasks discussed in this article. You can even fin…
Here is a helpful source code for C++ Builder programmers that allows you to manage and manipulate HTML content from C++ code, while also handling HTML events like onclick, onmouseover, ... Some objects defined and used in this source include: …
This tutorial covers a step-by-step guide to install VisualVM launcher in eclipse.
The viewer will learn how to synchronize PHP projects with a remote server in NetBeans IDE 8.0 for Windows.

895 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now