Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!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: Is there something better than ComponentListener on Resized Date: Tue, 01 Oct 2013 09:37:05 -0400 Organization: A noiseless patient Spider Lines: 43 Message-ID: References: <419a414e-356f-4d1c-ab98-cc6613081bcd@googlegroups.com> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Injection-Date: Tue, 1 Oct 2013 13:37:09 +0000 (UTC) Injection-Info: mx05.eternal-september.org; posting-host="0d73d8cc209bff1c6395088b400d0605"; logging-data="10374"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18EpgPle4G0wXHEaWDndH07" User-Agent: Mozilla/5.0 (Windows NT 5.1; rv:24.0) Gecko/20100101 Thunderbird/24.0 In-Reply-To: Cancel-Lock: sha1:SG4KoGip+T2gGEw3cPUJCM1vv2M= Xref: csiph.com comp.lang.java.programmer:25415 On 10/1/2013 8:39 AM, clusardi2k@aol.com wrote: >> On Monday, September 30, 2013 11:29:16 AM UTC-4, Eric Sosman wrote: >> Perhaps it's time to ask a question: Why do you think it's a good idea to >> prevent the user from arranging his own screen as he pleases? Does your program >> understand the user's needs and desires better than he himself does? > > I want to prevent the user from horizontally resizing the window beyond a certain width because (if I didn't) anything to the right of my two tables would be a a solid gray color of nothing. > > So, without the functionality that I want, if the user resizes the window it will look somthing like this exaggerated example: > > [][]|||||| > > Where I represent a table with [] and gray solid areas are represented by |. Maybe the user will find the blank gray expanses soothing? In any event, they're of his own making -- and he can un-make them again if he finds them objectionable. I sincerely doubt that your efforts to protect him from his own faulty aesthetic sense are worth while. > The code that I've, unsuccessfully, tried to use is similar to the code here: > > http://docs.oracle.com/javase/tutorial/uiswing/layout/gridbag.html Notice that this page is in a section whose title is "Lesson: Layout Out Components *Within* a Container" [emphasis mine]. You can control the sizes and layouts of things *inside* a top-level container pretty closely, but the TLC itself is a creature of the native windowing system, sized and positioned (and decorated, hidden, revealed, ...) by that native system. You're free to provide hints -- for example, the layout manager of the frame's content pane can suggest the pane's dimensions -- but the native windowing system is not obliged to honor your suggestions. (This is viewed as a Good Thing, because it gives your desktop app a fighting chance of being usable on a teeny- tiny phone screen, for example.) To put it more simplistically: Java doesn't own "the screen" and has no layout manager for it. -- Eric Sosman esosman@comcast-dot-net.invalid