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


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

Re: problem with setting

From "Andrew Thompson" <andrew.thompson@THRWHITE.remove-dii-this>
Subject Re: problem with setting
Message-ID <1164764837.523200.194750@h54g2000cwb.googlegroups.com> (permalink)
Newsgroups comp.lang.java.gui
References <1164729419.208051.309040@h54g2000cwb.googlegroups.com><
Date 2011-04-27 15:26 +0000
Organization TDS.net

Show all headers | View raw


  To: comp.lang.java.gui

Oliver Wong wrote:
> "Adam Sandler" <corn29@excite.com> wrote in message
> news:1164735690.470933.19080@80g2000cwy.googlegroups.com...
> >
> > Also, with regard to using setPreferredSize, see
> > http://groups.google.com/group/comp.lang.java.gui/browse_thread/thread/199fe80825ff337/0e96c1a7ea07b03b
>
>     I disagree with the claim that setPreferredSize() is evil.

Babu did qualify that statement directly after that, WTE
'unless absolutely necessary'.  AFAIR, the only times I
have absolutley needed to set the preferred size of
components is when I override paint()/paintComponent().

>...IMHO, that
> method is not incompatible with Layout Managers (whereas something like
> setSize() is).

Yes.  But I still think that any case of setting the preferred
size, or setting a null layout* should be something that you
can argue exactly *why* it needs setPreferredSize().

If you cannot justify it's use, you probably *should* not
use it, and instead investigate other possible ways to get
what you want  - which usually comes back to, 'fix the
current layout'.

It seems far too many people approach it the other
way around, thinking that setting the preferred size
of a component will fix a broken layout.

* Only reason I can think of is 'implementing a
custom LayoutManager'.

Andrew T.

---
 * 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 | Next in thread | Find similar


Thread

problem with setting a pa "Adam Sandler" <adam.sandler@THRWHITE.remove-dii-this> - 2011-04-27 15:26 +0000
  Re: problem with setting "Michael Dunn" <michael.dunn@THRWHITE.remove-dii-this> - 2011-04-27 15:26 +0000
  Re: problem with setting "Adam Sandler" <adam.sandler@THRWHITE.remove-dii-this> - 2011-04-27 15:26 +0000
    Re: problem with setting "Michael Dunn" <michael.dunn@THRWHITE.remove-dii-this> - 2011-04-27 15:26 +0000
      Re: problem with setting "Adam Sandler" <adam.sandler@THRWHITE.remove-dii-this> - 2011-04-27 15:26 +0000
    Re: problem with setting "Oliver Wong" <oliver.wong@THRWHITE.remove-dii-this> - 2011-04-27 15:26 +0000
    Re: problem with setting "Fred Kleinschmidt" <fred.kleinschmidt@THRWHITE.remove-dii-this> - 2011-04-27 15:26 +0000
  Re: problem with setting "Andrew Thompson" <andrew.thompson@THRWHITE.remove-dii-this> - 2011-04-27 15:26 +0000
  Re: problem with setting "Andrew Thompson" <andrew.thompson@THRWHITE.remove-dii-this> - 2011-04-27 15:26 +0000
  Re: problem with setting "Adam Sandler" <adam.sandler@THRWHITE.remove-dii-this> - 2011-04-27 15:26 +0000
  Re: problem with setting "Andrew Thompson" <andrew.thompson@THRWHITE.remove-dii-this> - 2011-04-27 15:26 +0000
    Re: problem with setting "Adam Sandler" <adam.sandler@THRWHITE.remove-dii-this> - 2011-04-27 15:26 +0000

csiph-web