>>>>> "Edward" == Edward King <[EMAIL PROTECTED]> writes:

    Edward>   I defined a GridBagLayout and put three component in it,I want to get 
this goal which I want to every component in the GridBagLayout occupy equal col 
size,like follows:
    Edward>    col 
    Edward> row 0                 1                  2 
    Edward>  0  _________________________________________________________
    Edward>  1 |  This is a test1 |                  |                   |
    Edward>  2 |  test2           |                  |                   |
    Edward>  3 |                  |                  |                   |
    Edward>  4 |                  |                  |                   |
    Edward>  5 |     one          |       two        |      thre         |
    Edward>     ---------------------------------------------------------

    [GridBagLayout code omitted]

    Edward> But when I run it,I found I got another result,each JButton occupy 
different col size,why?
    Edward>   col 
    Edward> row 0                 1        2 
    Edward>  0  _____________________________________
    Edward>  1 |  This is a test1 |        |         |
    Edward>  2 |  test2           |        |         |
    Edward>  3 |                  |        |         |
    Edward>  4 |                  |        |         |
    Edward>  5 |     one          |  two   |  thre   |
    Edward>     --------------------------------------

    Edward> I want to make JButton one,two and three looks occupy equal width in the 
screen. But JButtone looks bigger than JButton two and JButton three. How to make 
three JButtons look equal width size?

If you want each component to have the same width, then don't use
GBL. GridLayout would work better for this.  Read the Swing Tutorial on the Sun
Java web site for details about different layout managers.

-- 
===================================================================
David M. Karr          ; Java/J2EE/XML/Unix/C++
[EMAIL PROTECTED]   ; SCJP


_______________________________________________
Swing mailing list
[EMAIL PROTECTED]
http://eos.dk/mailman/listinfo/swing

Reply via email to