Prev: DIRECT CLIENT Opening: ITIM-TAM Analyst in Austin, TX.- 06+ months
Next: problems reading binary file
From: markspace on 8 Jun 2010 23:16 Sam Takoy wrote: > Doesn't the pack() operation go "inside-out". In other words, the > contained components suggest to the container what size it should be? I looked at this recently, due to someone else's question, and the answer turns out to be "no." As near as I can tell from examining the code, all operations are strictly "top down" from the root container to each of it's components to each of their components. Thus, both the initial "size" and the subsequent "resize" is the same, from the layout manager's point of view.
From: Sam Takoy on 9 Jun 2010 00:05 On 6/8/2010 11:16 PM, markspace wrote: > Sam Takoy wrote: > >> Doesn't the pack() operation go "inside-out". In other words, the >> contained components suggest to the container what size it should be? > > > I looked at this recently, due to someone else's question, and the > answer turns out to be "no." As near as I can tell from examining the > code, all operations are strictly "top down" from the root container to > each of it's components to each of their components. > > Thus, both the initial "size" and the subsequent "resize" is the same, > from the layout manager's point of view. > So, perhaps pack() has some special features on top of the layout logic?
From: markspace on 9 Jun 2010 00:55 Sam Takoy wrote: > > So, perhaps pack() has some special features on top of the layout logic? Not really. I think it just calls preferredLayoutSize(Container) first, to set its own bounds, then it lays out the container with those same bounds. (This is a good reason for a layout manager to cache results.) It doesn't matter though. Just implement your LayoutManager according to the Java docs and the rest will work out. Only if you're implementing a top level window yourself, it might matter.
From: bugbear on 9 Jun 2010 03:53 Sam Takoy wrote: > Hi, > > I'm writing a custom layout manager and here's what I don't understand. > > My experience tells that, generally speaking, there are two modes of > layout. One, when the layout happens for the first time and all elements > assume the size that they would most like. > > In the second mode, when the user resizes the JFrame, all elements > inside just need to deal. > > So, in layoutContainer(Container parent), how do I know what mode it is? You assumption is wrong. Whilst objects can (in effect) provide hints and requests to the LayoutManager, the LayoutManager always decides size and position. I would recommend the documentation and Sun's tutorials. Further, in this area, beware of "working examples" found on the web. Most of them are either incomplete, inefficient, or both. BugBear
From: John B. Matthews on 10 Jun 2010 11:46 In article <humu2b$q3d$1(a)news.eternal-september.org>, Sam Takoy <sam.takoy(a)yahoo.com> wrote: > On 6/8/2010 9:20 PM, Jeff Higgins wrote: > > On 6/8/2010 8:13 PM, Sam Takoy wrote: > >> Hi, > >> > >> I'm writing a custom layout manager and here's what I don't understand. > >> > >> My experience tells that, generally speaking, there are two modes of > >> layout. > > > > Please be specific. > > Read my question I too believe your modality premise is false, but I would welcome a counter example. <http://groups.google.com/group/comp.lang.java.programmer/browse_frm/thread/420e9da9a927201f> -- John B. Matthews trashgod at gmail dot com <http://sites.google.com/site/drjohnbmatthews>
First
|
Prev
|
Pages: 1 2 Prev: DIRECT CLIENT Opening: ITIM-TAM Analyst in Austin, TX.- 06+ months Next: problems reading binary file |