aspose file tools*
The moose likes Developer Certification (SCJD/OCMJD) and the fly likes Resizing whole frame Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Certification » Developer Certification (SCJD/OCMJD)
Bookmark "Resizing whole frame" Watch "Resizing whole frame" New topic
Author

Resizing whole frame

Stephane Weber
Ranch Hand

Joined: Mar 07, 2002
Posts: 110
Hi all,
Is it acceptable to define all components of the application (and in particular the global frame) to be non-resizable ?
If not, could anyone tell me how they managed the resizing of the global frame ? (When I try to resize mine (which in fact doesn't make sense to me) I get an awful display ...
Thanks,
Stephane
Michael Morris
Ranch Hand

Joined: Jan 30, 2002
Posts: 3451
Hi Stephane,

Is it acceptable to define all components of the application (and in particular the global frame) to be non-resizable ?

I would say no based on the fact that you don't necessarily know how much screen space your user has. Locking the frame to a single size will not win you any popularity contest among users.

If not, could anyone tell me how they managed the resizing of the global frame ? (When I try to resize mine (which in fact doesn't make sense to me) I get an awful display ...

It takes quite a bit of up front work deciding what layout managers or combination of layout managers to use. I like to take a 12x18 dry erase board or a legal pad and sketch my components there before making any final decisions about layout. By sketching a small and large version, I determine what managers I need to accomplish the particular effect. For this assignment, I used a combination of Grid, Flow and Border Layouts. In a recent post though I had to holler "Uncle" when I suggested someone not use a GridBagLayout due to its complexity. GridBagLayout will certainly give you total control over the GUI behavior but is more complicated to implement.
Hope this helps,
Michael Morris


Any intelligent fool can make things bigger, more complex, and more violent. It takes a touch of genius - and a lot of courage - to move in the opposite direction. - Ernst F. Schumacher
Jim Bedenbaugh
Ranch Hand

Joined: Nov 09, 2001
Posts: 171

Is it acceptable to define all components of the application (and in particular the global frame) to be non-resizable ?

Probably not. I suspect the 2 point I had deducted from my GUI (the only points deducted from my project) were because I did not let the user resize the JSplitPane I used to separate the upper portion of the screen from the JTable below.
I would recommend allowing the user total control over these components where it makes sense.

If not, could anyone tell me how they managed the resizing of the global frame ? (When I try to resize mine (which in fact doesn't make sense to me) I get an awful display ...

The only thing I can tell you is to use the best practices recommended for GUI design. Since each design is unique, there is no hard and fast rule. You can find several books on this area as well as some web sites that outline the general rules. Part of the exam is testing to see if you have an understanding of this.
I personally used GridBagLayout because it makes sense to me and I don't find it's implementation difficult, but then I spent the summer of 2001 doing nothing but studying and gaining expertise with Swing because I knew I would have to eventually use it.


Regards,
Jim
SCJP, SCJD, SCWCD, SCEA Part I
Mark Spritzler
ranger
Sheriff

Joined: Feb 05, 2001
Posts: 17259
    
    6

I did not let the user resize the screen and I got 20/20 on GUI.
Mark


Perfect World Programming, LLC - Two Laptop Bag - Tube Organizer
How to Ask Questions the Smart Way FAQ
Stephane Weber
Ranch Hand

Joined: Mar 07, 2002
Posts: 110
Hi Mark,
Do you mean that you fixed the size of your main Frame once and for all at the beginning and set it as non resizable ?
Because, if this is right, then I don't have to worry about changing my layout, which displays perfectly if not resized.
Thanks,
Stephane
Mark Spritzler
ranger
Sheriff

Joined: Feb 05, 2001
Posts: 17259
    
    6

Originally posted by Stephane Weber:
Hi Mark,
Do you mean that you fixed the size of your main Frame once and for all at the beginning and set it as non resizable ?
Because, if this is right, then I don't have to worry about changing my layout, which displays perfectly if not resized.
Thanks,
Stephane

That is exactly what I did. setSize() to my size I wanted, then setResizable(false);


Mark
Valentin Crettaz
Gold Digger
Sheriff

Joined: Aug 26, 2001
Posts: 7610
setSize(900,475);
setResizable(false);

What happens then if the assessor tests the application with a 640x480 resolution?
I took the GridBagLayout solution which allows to resize any component, anywhere, anyhow and at any time... A bit more work to get it done, but when it's done, it's done and it's nice, in my opinion...
[ September 18, 2002: Message edited by: Valentin Crettaz ]

SCJP 5, SCJD, SCBCD, SCWCD, SCDJWS, IBM XML
[Blog] [Blogroll] [My Reviews] My Linked In
Stephane Weber
Ranch Hand

Joined: Mar 07, 2002
Posts: 110
I already tried before to use the GridBagLayout but I must admit I didn't intend to put too much work in it.
If trying to use it to allow resizing to happen, am I right if I say that I have then to put each JPanel I have in my main frame in a JScrollPane ?
Otherwise, how would they be handled if the frame shrinks to the point that not all the text can still be visible ?
Please help
Stephane
Stephane Weber
Ranch Hand

Joined: Mar 07, 2002
Posts: 110
Ok, if you put some time in it, you always find what you are looking for. I had to try a lot of things, but now I have a GridBagLayout that displays as I want and that resizes correctly.
However, to avoid meaningless display, I still had to impose a minimum size to my frame, by overriding its componentResized method and checking that new values where not smaller than (250, 400), where the display is still usable.
Do you think that is acceptable ?
Thanks again for all precious help,
Stephane
Mark Spritzler
ranger
Sheriff

Joined: Feb 05, 2001
Posts: 17259
    
    6

That sounds acceptable.
Valentin, that's a fine point if the assessor has his resolution to 640x480. But I guess he didn't. I got 20/20 on the GUI. 1024x768 has become the standard resolution. 640 used to be way back when
Mark
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Resizing whole frame