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 / May 2005

Tip: Looking for answers? Try searching our database.

BoxLayout making component too big

Thread view: 
Nomak - 26 Apr 2005 10:29 GMT
Hello,

if i put some component in a FlowLayout, they have a "clever" size. But i need to have them verticaly, so i use a BoxLayout(Y_AXIS). But the layout make the components big to fill all the panel space (in fact the 2 radio button are ok, but the combo box has a big height).

How can i prevent that? I reaaly juste need a flowlayout but vertical. If i must say wich size (preferred, min, max) to use, it's simpler to use a "null" layout.

Thx for your help
John McGrath - 28 Apr 2005 22:25 GMT
> if i put some component in a FlowLayout, they have a "clever" size. But
> i need to have them verticaly, so i use a BoxLayout(Y_AXIS). But the
> layout make the components big to fill all the panel space (in fact the
> 2 radio button are ok, but the combo box has a big height).

See "How to Use BoxLayout" in the Java Tutorial.  Check out the part on
rigid areas, glue, and custom fillers.

http://java.sun.com/docs/books/tutorial/uiswing/layout/box.html

Signature

Regards,

John McGrath

Nomak - 29 Apr 2005 08:57 GMT
> > if i put some component in a FlowLayout, they have a "clever" size. But
> > i need to have them verticaly, so i use a BoxLayout(Y_AXIS). But the
[quoted text clipped - 5 lines]
>
> http://java.sun.com/docs/books/tutorial/uiswing/layout/box.html

well, i did, but when running the demo associated with this:

http://java.sun.com/docs/books/tutorial/uiswing/layout/example-1dot4/BorderLayou
tDemo.java


the buttons have a "good" size, they don't fill all the panel.

By looking at the code, you can see that there isn't any Box.Filler or related.

So why is it working?
Aki \ - 29 Apr 2005 10:14 GMT
>>See "How to Use BoxLayout" in the Java Tutorial.  Check out the part on
>>rigid areas, glue, and custom fillers.
[quoted text clipped - 10 lines]
>
> So why is it working?

Since it is using BorderLayout, not BoxLayout?

Signature

-Aki "Sus" Laukkanen
"Älä multa kysy tai mä vastaan!"
"Don't ask me or I'll answer!"

Nomak - 29 Apr 2005 13:47 GMT
> Since it is using BorderLayout, not BoxLayout?

sorry, wrong link

http://java.sun.com/docs/books/tutorial/uiswing/layout/example-1dot4/BoxLayoutDe
mo.java

John McGrath - 29 Apr 2005 20:04 GMT
> the buttons have a "good" size, they don't fill all the panel.

A BoxLayout will *try* to fill the container that it lays out, but it will
also respect the preferred, minimum, and maximum sizes of the components
in the container.  If they do not fill the container at their maximum
sizes, it will leave the extra space at the end.

Signature

Regards,

John McGrath

Sean Anderson - 14 May 2005 00:54 GMT
I have set the max size for my components in a vertiaclBox and they are all
centered in the damn window.

Why?

> > the buttons have a "good" size, they don't fill all the panel.
>
[quoted text clipped - 7 lines]
>
> John McGrath
John McGrath - 17 May 2005 00:12 GMT
> I have set the max size for my components in a vertiaclBox and
> they are all centered in the damn window.
>
> Why?

I would guess you have a bug in your code.  I have no idea how to figure
out exactly what the problem is without seeing the code.  Please post a
runnable example of the problem.

Signature

Regards,

John McGrath

Ted Hill - 04 May 2005 19:56 GMT
My advice is use TableLayout

http://www.clearthought.info/software/TableLayout/

http://java.sun.com/products/jfc/tsc/articles/tablelayout/

This is the most flexible and easy to use too.

I used to use BoxLayout a lot until I found out about TableLayout.
Ted Hill - 04 May 2005 19:56 GMT
My advice is use TableLayout

http://www.clearthought.info/software/TableLayout/

http://java.sun.com/products/jfc/tsc/articles/tablelayout/

This is the most flexible and easy to use too.

I used to use BoxLayout a lot until I found out about TableLayout.


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.