Size of GridLayout

Discussion in 'Java' started by Jo, Apr 10, 2004.

  1. Jo

    Jo Guest

    How do I set the size of one "cell" in a GridLayout?
    Jo, Apr 10, 2004
    #1
    1. Advertising

  2. Jo

    Bjorn Abelli Guest

    "Jo" wrote...

    > How do I set the size of one "cell" in a GridLayout?


    You don't...

    To "set the size on a singular cell" is rather another paradigm on how
    layouts are made, than the underlying premises on how the LayoutManagers
    work.

    The use of exact pixel sizes was more or less abandoned for the use of
    relative sizes. This is to some degree based on the premise that you would
    probably prefer the look of the layout to adapt more to the actual
    platform...

    To make a long story short:

    Say for example that you define a panel with a GridLayout(3, 2).

    If the size of the panel is height 60 and width 30, then *each* cell will be
    height 20 an width 15.

    If you change the size of the panel to height 30 and width 60, the size of
    *each* cell will be height 10 and width 30.

    As you see the sizes of the individual cells are set "relatively" to the
    size of the container.

    // Bjorn A


    P.S.

    Questions of this kind should only be posted to comp.lang.java.gui.
    No sense in posting it to comp.lang.java.programmer.
    Bjorn Abelli, Apr 10, 2004
    #2
    1. Advertising

  3. Jo

    Jim Cobban Guest

    "Jo" <> wrote in message
    news:c593nj$2qfp46$-berlin.de...
    > How do I set the size of one "cell" in a GridLayout?
    >

    GridLayout is simply a convenience mechanism to avoid you having to
    explicitly specify the position of every component on a panel. The layout
    takes the size information for each of the components and calculates where
    they should be within the enclosing component. You set the size information
    of the individual components. This can be done even after they are added to
    the enclosing component as long as it is before you pack the frame the
    component is displayed in.
    Jim Cobban, Apr 10, 2004
    #3
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Christian
    Replies:
    0
    Views:
    348
    Christian
    Jul 21, 2003
  2. Kenneth

    Gridlayout problems

    Kenneth, Oct 15, 2003, in forum: ASP .Net
    Replies:
    1
    Views:
    346
    Cowboy \(Gregory A. Beamer\)
    Oct 15, 2003
  3. Stephen

    flowlayout vs. gridlayout

    Stephen, Dec 5, 2003, in forum: ASP .Net
    Replies:
    5
    Views:
    5,919
    mikeb
    Dec 5, 2003
  4. Ike
    Replies:
    2
    Views:
    365
  5. VisionSet

    Re: panels size on gridlayout

    VisionSet, Jul 10, 2003, in forum: Java
    Replies:
    2
    Views:
    509
Loading...

Share This Page