Path: csiph.com!eternal-september.org!feeder.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail From: Eric Sosman Newsgroups: comp.lang.java.programmer Subject: Re: What do you think of my CropImage class Date: Thu, 21 Jul 2016 14:24:22 -0400 Organization: A noiseless patient Spider Lines: 23 Message-ID: References: <87twfk93vu.fsf@Equus.decebal.nl> <8737n36ucx.fsf@Equus.decebal.nl> <878twu6i0l.fsf@Equus.decebal.nl> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Injection-Date: Thu, 21 Jul 2016 18:24:35 -0000 (UTC) Injection-Info: mx02.eternal-september.org; posting-host="2d081e2f7155c28005d4472f67c2f43d"; logging-data="10362"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/AzqQ1ckppV0Se4vkSQlmQ" User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:45.0) Gecko/20100101 Thunderbird/45.2.0 In-Reply-To: Cancel-Lock: sha1:51IUduIl7oimXEbEwdThzy5ZHRw= Xref: csiph.com comp.lang.java.programmer:35064 On 7/21/2016 1:25 PM, Eric Douglas wrote: > On Thursday, July 21, 2016 at 1:14:08 PM UTC-4, Cecil Westerhof wrote: >> > > I never or rarely use pack, though many examples on the web do. It automatically sets the size and location of your controls based on their size values, the layout, and the other controls on the same pane. In our application that's irrelevant since we use non-resizeable windows and fixed locations and widths. The pack values have to do with one of the sizes (each control has getSize(), getPreferredSize(), getMinimumSize(), getMaximumSize()) and whether the control is visible. When (non-null) layout managers are in use, pack() causes them all to do their thing, establishing the positions and sizes of the contents they manage. If you're using absolute positioning instead of layout managers, I suppose pack() can be dispensed with. ("I suppose," because I've never been 100% confident that I understand why both pack() and validate() exist; there may be things going on that I don't know about.) ... but I'd use it anyhow, because even if *my* component uses no layout manager, something I embed in it might. For example, a JSpinner has assorted sub-bits and sub-pieces, uses its own layout manager to size and position them. I'm not sure what happens if you try to display a JSpinner that's never been pack()ed; it might well depend on the look-and-feel in force. -- esosman@comcast-dot-net.invalid "Don't be afraid of work. Make work afraid of you." -- TLM