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 / January 2004

Tip: Looking for answers? Try searching our database.

resize the width of JToolBar, JMenuBar and decorator of JFrame?

Thread view: 
Kyle Sun - 13 Jan 2004 01:41 GMT
Anyone knows how to resize the width of
JToolBar, JMenuBar and decorator of JFrame?

The length of them is dynamically but the width of them
seems always to be fastened. I expect to change them
but don't know how.

Thanks for your help!
Steve W. Jackson - 14 Jan 2004 17:19 GMT
>:Anyone knows how to resize the width of
>:JToolBar, JMenuBar and decorator of JFrame?
[quoted text clipped - 4 lines]
>:
>:Thanks for your help!

By decorator, I assume you mean the minimize, maximize and close
decorations, for example, and you can't resize those unless you make
your own.  They're provided by the host OS, not by Java.

Both JToolBar and JMenuBar are subclasses of JComponent, and ultimately
back to Container, which lets you use a layout manager of your choice.  
It also lets you set min, max and preferred sizes.  You may want to get
more familiar with these areas.

In the case of a JMenuBar, I can't imageine why you'd want to mess with
its width anyway -- it's typically handled by the UI.  But it's your
app, so I can't second guess your needs.

For a JToolBar, it's more a function of what you put into it -- and he
layout manager you use.  The default layout manager is FlowLayout, which
wraps things if it gets too short.  I don't remember whether it respects
min/max sizes of the items placed into the toolbar.  I used a different
layout manager for more complex toolbars, and I specifically set the
min, max and preferred sizes on all those components.

HTH.

= Steve =
Signature

Steve W. Jackson
Montgomery, Alabama



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.