The other responses to this question, already sent, lay out the basics.

In practice, I found that most of my fairly complex JPanels needed to be GridBagLayout in order to handle multiple screen resolutions. Displaying the same JPanel on 640X480 vs. 1600X1200 can be a real eye-opener, especially if you resize things.

GridBagLayout is a real pain to get working. There are subtle interactions among the GridBagConstraints parameters, which are themselves pretty confusing.

However, when you get it right, resizing windows and multiple screen resolutions are handled quite gracefully. Extra space is allocated according to your specs and elements that won't fit are clipped in controllable ways.

Very often, you need to define several layers of JPanels within other JPanels. Each of these can have a Preferred Size, Min Size, and Max Size. Nesting them takes some planning.

Hugh

At 01:57 PM 9/1/2003 -0400, Richard O. Hammer wrote:
How are component sizes determined in AWT and Swing?  My limited experience with GUI building has generally left me frustrated, because there are many sizing mechanisms available which do not seem to work.  My attempts to set sizes routinely get ignored or overridden.

I would like to believe that there is some design principle which has been implemented in the Java GUI APIs, and that once I learn that principle then I can know ahead of time which of the available sizing mechanisms will work.  But as it is, without knowing the principle, I have to try and fail and try and fail and try  ...

I'd dream of finding an article named "How the sizes of Java GUI components are determined".  Can anybody point me to that?

Thanks,

Rich Hammer


_______________________________________________
Juglist mailing list
[EMAIL PROTECTED]
http://trijug.org/mailman/listinfo/juglist_trijug.org

_______________________________________________
Juglist mailing list
[EMAIL PROTECTED]
http://trijug.org/mailman/listinfo/juglist_trijug.org

Reply via email to