The short answer is "it depends on the layout manager".

For instance if you use border layout and stick it in the center, the answer
is "it will completely ignore the preferred size and make it the size of the
window minus the NSEW..."

Its like HTML... 

On 9/2/03 5:16 PM, "Richard O. Hammer" <[EMAIL PROTECTED]> wrote:

> Thanks to those who have responded to my question.
> 
> I know about layout managers, and some years ago made a handful of
> frames with gridbaglayout, getting them laid out well enough for my
> need at the time.  But I remember the need for trial and error,
> setting sizes and preferred sizes and usually having my settings
> ignored when the component was displayed, until somehow I stumbled
> onto something that worked.  Trial and error works, given time.
> 
> Which size settings work in which circumstances?  Is there anybody
> savvy enough to predict and get results better than random?  If so
> that person might know some principles.  I'd like to know those
> principles too.
> 
> At present I am beating my head against the sizes of columns in a
> JTable.  In preference to descending into the specifics of what I am
> trying to do with a JTable, I have hoped to learn principles which I
> might apply ... assuming those principles exist.
> 
> Joe Sam Shirah wrote:
>>     My recommendations for serious Swing developers are David Geary's
>> Graphic Java series, Volume 1 ( AWT ) and Volume 2 (  JFC ), and John
> 
> Thank you.  I've heard Geary's books recommended before, and have
> ordered the Volume 1.
> 
> Rich Hammer
> 
> 
>> ----- Original Message -----
>> From: "Richard O. Hammer" <[EMAIL PROTECTED]>
>> To: "Java Users Group" <[EMAIL PROTECTED]>
>> Sent: Monday, September 01, 2003 1:57 PM
>> Subject: [Juglist] the sizing of Java GUI components
>> 
>>> 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?
> 
> 
> _______________________________________________
> Juglist mailing list
> [EMAIL PROTECTED]
> http://trijug.org/mailman/listinfo/juglist_trijug.org

-- 
Andrew C. Oliver
http://www.superlinksoftware.com/poi.jsp
Custom enhancements and Commercial Implementation for Jakarta POI

http://jakarta.apache.org/poi
For Java and Excel, Got POI?

The views expressed in this email are those of the author and are almost
definitely not shared by the Apache Software Foundation, its board or its
general membership.  In fact they probably most definitively disagree with
everything espoused in the above email.


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

Reply via email to