Lockable JFrames?

Discussion in 'Java' started by Zerex71, Apr 29, 2008.

  1. Zerex71

    Zerex71 Guest

    Greetings,

    I was wondering if there was a way to "lock" a JFrame to a certain
    size to prevent user resize attempts. It won't kill me not to have it
    but I would like to keep a JFrame (containing a drawing canvas) to
    stay a fixed size. I have looked through all the documentation and
    the set*Size() methods don't seem to do it for me.

    Thanks,
    Mike
     
    Zerex71, Apr 29, 2008
    #1
    1. Advertising

  2. Zerex71

    Zerex71 Guest

    On Apr 29, 10:48 am, "Matt Humphrey" <> wrote:
    > "Zerex71" <> wrote in message
    >
    > news:...
    >
    > > Greetings,

    >
    > > I was wondering if there was a way to "lock" a JFrame to a certain
    > > size to prevent user resize attempts. It won't kill me not to have it
    > > but I would like to keep a JFrame (containing a drawing canvas) to
    > > stay a fixed size. I have looked through all the documentation and
    > > the set*Size() methods don't seem to do it for me.

    >
    > frame.setResizable(false)
    >
    > Matt Humphreyhttp://www.iviz.com/


    Thank you! I did not spot that in any of the methods in the
    inheritance tree in the API documentation.

    Mike
     
    Zerex71, Apr 29, 2008
    #2
    1. Advertising

  3. myFrame.setResizable(false);

    What I want to know, is there a way to set a max/min size for a frame?
     
    Chase Preuninger, Apr 30, 2008
    #3
  4. Chase Preuninger wrote:
    > myFrame.setResizable(false);
    >
    > What I want to know, is there a way to set a max/min size for a frame?


    AFAIK the best you can do is catch resizing events and if the new size
    is outside your bounds, resize the frame to bring it back within bounds.
    This looks a bit odd to the user.

    --
    RGB
     
    RedGrittyBrick, Apr 30, 2008
    #4
  5. Zerex71

    Zerex71 Guest

    On Apr 29, 9:27 pm, Chase Preuninger <>
    wrote:
    > myFrame.setResizable(false);
    >
    > What I want to know, is there a way to set a max/min size for a frame?


    You could try setMinimumSize(Dimension) and setMaximumSize(Dimension).
     
    Zerex71, Apr 30, 2008
    #5
    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. Lukasz Indyk
    Replies:
    6
    Views:
    502
    Andrew Thompson
    Jan 23, 2004
  2. Lynx

    Two JFrames, one dialog

    Lynx, Nov 7, 2004, in forum: Java
    Replies:
    2
    Views:
    581
    Larry Barowski
    Nov 8, 2004
  3. rfractal30
    Replies:
    0
    Views:
    2,348
    rfractal30
    Apr 11, 2005
  4. rfractal30
    Replies:
    1
    Views:
    464
    rfractal30
    Apr 14, 2005
  5. Will McGugan
    Replies:
    1
    Views:
    307
    Bruno Desthuilliers
    Jul 12, 2006
Loading...

Share This Page