Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / GUI / July 2004

Tip: Looking for answers? Try searching our database.

JFrame Size

Thread view: 
<- Chameleon -> - 27 Jul 2004 18:13 GMT
I have a JFrame which I want an initial size 500x400.

For Layout I use GridBagLayout

My JFrame is this:
JFrame( JTabbedPane( JScrollPane(JTextArea) ) )

I want JTabbedPane (with its contents) take whole surface of JFrame even if
I resize JFrame

How can I do this? I am a newbie in Java API.
Tarlika Elisabeth Schmitz - 28 Jul 2004 10:54 GMT
Hello,

> I have a JFrame which I want an initial size 500x400.

Why specify a fixed size? That isn't good practice. The components'
preferred sizes should dictate the overall size required. The layout
manager will handle that for you.

> For Layout I use GridBagLayout
>
> I want JTabbedPane (with its contents) take whole surface of JFrame even if
> I resize JFrame

I suggest you use JGoodies forms (freeware) rather than GridBagLayout.
JGoodies forms' grid layout is much easier to comprehend and, in your
example, you can specify with easy that the component should fill the frame.
http://www.jgoodies.com/downloads/libraries.html

Signature

Regards/Gruß,

Tarlika Elisabeth Schmitz

Carl Smotricz - 28 Jul 2004 17:40 GMT
This is an example of a situation where GridBagLayout is overkill.

If you give the JFrame a BorderLayout and add() the JTabbedPane in its
CENTER, then the JFrame will always automatically fill the entire JFrame.

> I have a JFrame which I want an initial size 500x400.
>
[quoted text clipped - 7 lines]
>
> How can I do this? I am a newbie in Java API.


Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.