Solved

setting JFrame LayoutManager to NORTH

Posted on 2007-04-09
1
306 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
Comment Utility
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

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

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.
How to install Selenium IDE and loops for quick automated testing. Get Selenium IDE from http://seleniumhq.org (http://seleniumhq.org) Go to that link and select download selenium in the right hand columnThat will then direct you to their downlo…
THe viewer will learn how to use NetBeans IDE 8.0 for Windows to perform CRUD operations on a MySql database.
The viewer will learn how to use and create keystrokes in Netbeans IDE 8.0 for Windows.

763 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

7 Experts available now in Live!

Get 1:1 Help Now