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
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
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.
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
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);
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 ]
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
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
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
Post by:autobot
Let me tell you a story about a man named Jed. He made this tiny ad:
a bit of art, as a gift, that will fit in a stocking