Solved

setting JFrame LayoutManager to NORTH

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

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

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 and create keystrokes in Netbeans IDE 8.0 for Windows.
The viewer will learn how to synchronize PHP projects with a remote server in NetBeans IDE 8.0 for Windows.

713 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