null layout

Discussion in 'Java' started by patrick, Nov 30, 2003.

  1. patrick

    patrick Guest

    Ive made a java application JFrame with several JPanels and a few
    components.
    All the layouts I have set to null.
    the frame size ive set: setSize(new Dimension(790, 575));

    This displays on my screen when it is run as 8.6 inches by 6.25 inches
    approx.

    When I change the screen resolution from 1024 by 768 to higher resolutions
    and run it again it still
    displays as 8.6 inches by 6.25 inches.

    I dont understand that. With null layout I expect it to be less than 8.6
    inches width

    why does it not shrink in size when I increase the screen resolution?


    thanks
    patrick
    patrick, Nov 30, 2003
    #1
    1. Advertising

  2. patrick

    ak Guest

    with setLayout you can't change size of (J)Frame, only JPanels inside.

    code snippet could be helpful.

    --

    ____________

    http://reader.imagero.com the best java image reader.

    "patrick" <> schrieb im Newsbeitrag
    news:LVnyb.2773$...
    >
    >
    > Ive made a java application JFrame with several JPanels and a few
    > components.
    > All the layouts I have set to null.
    > the frame size ive set: setSize(new Dimension(790, 575));
    >
    > This displays on my screen when it is run as 8.6 inches by 6.25 inches
    > approx.
    >
    > When I change the screen resolution from 1024 by 768 to higher resolutions
    > and run it again it still
    > displays as 8.6 inches by 6.25 inches.
    >
    > I dont understand that. With null layout I expect it to be less than 8.6
    > inches width
    >
    > why does it not shrink in size when I increase the screen resolution?
    >
    >
    > thanks
    > patrick
    >
    >
    ak, Nov 30, 2003
    #2
    1. Advertising

  3. Am Sun, 30 Nov 2003 19:15:06 +0100 schrieb ak:

    > with setLayout you can't change size of (J)Frame, only JPanels inside.


    With setLayout you wan't set any sizes by pixels, but I guess the OP sets
    the size by JFrame#setSize(int, int).

    This should be the last call before JFrame#show(), definitely after
    JFrame#pack(). pack() would recall the preferred sizes of the inlaying
    components and resizes the window. See java.awt.Window#pack() for details.

    HTH, Michael.
    Michael Holtermann, Dec 1, 2003
    #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. Rick Spiewak
    Replies:
    3
    Views:
    3,147
    Rick Spiewak
    Aug 26, 2003
  2. RobertH
    Replies:
    1
    Views:
    718
    Steve C. Orr [MVP, MCSD]
    Nov 4, 2003
  3. NWx
    Replies:
    4
    Views:
    2,959
    Kevin Spencer
    Feb 19, 2004
  4. Replies:
    5
    Views:
    26,589
    Mike Schilling
    Mar 29, 2006
  5. Replies:
    1
    Views:
    571
    John Timney \(MVP\)
    Jun 19, 2006
Loading...

Share This Page