Solved

setting JFrame LayoutManager to NORTH

Posted on 2007-04-09
1
309 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

3 Use Cases for Connected Systems

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, testing some more, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us.

Question has a verified solution.

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

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: …
Jaspersoft Studio is a plugin for Eclipse that lets you create reports from a datasource.  In this article, we'll go over creating a report from a default template and setting up a datasource that connects to your database.
The viewer will learn how to use NetBeans IDE 8.0 for Windows to connect to a MySQL database. Open Services Panel: Create a new connection using New Connection Wizard: Create a test database called eetutorial: Create a new test tabel called ee…
The viewer will learn how to use and create new code templates in NetBeans IDE 8.0 for Windows.

773 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