Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.java.gui > #2009

Re: Requesting re-pack'in

From "tar" <tar@THRWHITE.remove-dii-this>
Subject Re: Requesting re-pack'in
Message-ID <ymi1wfgp5mm.fsf@sevak.isi.edu> (permalink)
Newsgroups comp.lang.java.gui
References <f6r6dt$5ak$1@newsreader2.utanet.at>
Date 2011-04-27 15:36 +0000
Organization TDS.net

Show all headers | View raw


  To: comp.lang.java.gui
Daniel Kraft <d@domob.eu> writes:

> Hi all,
>
> However, during execution time this preferred size changes; is there a
> *generic* way to propagate this message up to the Frame so it re-pack()s?
> 
> 
> I do not want to use a succession of getParent() until I reach the Frame
> and call pack() on it, as this component might be used in a situation
> which does not allow this in the future (maybe an Applet or in an
> resizable/unpacked Frame as part of a more complex layout).

Well, that is really the only way to force pack() to be called again.
It is a method that is called externally and not in response to other
generated messages.

> Is there any way to achieve this?  I.e., propagate to the Frame/layout
> that the preferred size has changed and this should be considered anew?

The best you can hope for here is to call revalidate() (or perhaps an
invalidate()/validate() pair).  This should propagate upwards and force
the layout to be recomputed.

The difference is that the revalidate() approach will not shrink the
existing size of the frame.  It will lay out the components again and
IIRC can expand the frame size.  The only way to shrink the size is to
call pack() on the frame.


Hmmm, a thought.  Is there some other approach using a custom layout
manager?

-- 
Thomas A. Russ,  USC/Information Sciences Institute

---
 * Synchronet * The Whitehouse BBS --- whitehouse.hulds.com --- check it out free usenet!
--- Synchronet 3.15a-Win32 NewsLink 1.92
Time Warp of the Future BBS - telnet://time.synchro.net:24

Back to comp.lang.java.gui | Previous | NextPrevious in thread | Find similar | Unroll thread


Thread

Requesting re-pack'ing of "Daniel Kraft" <daniel.kraft@THRWHITE.remove-dii-this> - 2011-04-27 15:36 +0000
  Re: Requesting re-pack'in "tar" <tar@THRWHITE.remove-dii-this> - 2011-04-27 15:36 +0000

csiph-web