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


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

Re: Overriding JComponent or implementing ComponentUI?

Path csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!news.glorb.com!npeer02.iad.highwinds-media.com!news.highwinds-media.com!feed-me.highwinds-media.com!border3.nntp.dca.giganews.com!border1.nntp.dca.giganews.com!nntp.giganews.com!postnews.google.com!glegroupsg2000goo.googlegroups.com!not-for-mail
From Lew <lewbloch@gmail.com>
Newsgroups comp.lang.java.gui
Subject Re: Overriding JComponent or implementing ComponentUI?
Date Tue, 10 Jul 2012 13:25:30 -0700 (PDT)
Organization http://groups.google.com
Lines 34
Message-ID <2e32e65c-5e3a-404b-983f-6881d93d3748@googlegroups.com> (permalink)
References <kN1Ir.59786$GJ4.56436@newsfe16.iad> <jtfqbg$4uo$1@dont-email.me> <jtgi6o$va0$1@news.albasani.net> <jthrmi$qu3$1@dont-email.me>
NNTP-Posting-Host 69.28.149.29
Mime-Version 1.0
Content-Type text/plain; charset=ISO-8859-1
X-Trace posting.google.com 1341951931 19517 127.0.0.1 (10 Jul 2012 20:25:31 GMT)
X-Complaints-To groups-abuse@google.com
NNTP-Posting-Date Tue, 10 Jul 2012 20:25:31 +0000 (UTC)
In-Reply-To <jthrmi$qu3$1@dont-email.me>
Complaints-To groups-abuse@google.com
Injection-Info glegroupsg2000goo.googlegroups.com; posting-host=69.28.149.29; posting-account=CP-lKQoAAAAGtB5diOuGlDQk0jIwmH0T
User-Agent G2/1.0
X-Received-Bytes 2717
Xref csiph.com comp.lang.java.gui:5195

Show key headers only | View raw


Daniele Futtorovic wrote:
> Lew allegedly wrote:
> &gt; Daniele Futtorovic wrote:
> &gt;&gt; FWIW (as it&#39;s been a while I&#39;ve done GUI code), the more complex and
> &gt;&gt; specialised custom components I wrote, the further I lent towards
> &gt;&gt; ComponentUIs. Unfortunately, I don&#39;t remember any exact benefit. Perhaps
> &gt;&gt; a matter of cleanness and encapsulation (as it feels &quot;more right&quot; to put
> &gt;&gt; that code in a dedicated place, rather than overriding stuff in the
> &gt;&gt; component). There&#39;s also the issue of shared resources, although those
> &gt;&gt; can be dealt with similarly in JComponent.
> &gt;&gt;
> &gt;&gt; I realise that was a terribly useless post. Sorry about that. :)
> &gt; 
> &gt; Honestly, I thought it was going to be useless for a second, but it
> &gt; turned out to be rather thought-provoking and best-practice oriented.
> &gt; 
> &gt; Assuming I understood your remarks correctly.
> &gt; 
> &gt; Josh Bloch says, &quot;Prefer composition to inheritance.&quot;
> &gt; 
> &gt; In GUI terms this translates to, &quot;Usually you have a JFrame as a member
> &gt; rather than as a supertype.&quot;
> &gt; 
> 
> Indeed the good man does, and indeed the good man is right. But I would
> have liked to be able to find in my experience a pratical illustration
> of that bit of wisdom. For, while trust may be fine, knowledge is good. :}

Well, the bit about making a JFrame a member rather than supertype is a 
practical illustration.

-- 
Lew

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


Thread

Overriding JComponent or implementing ComponentUI? Daniel Pitts <newsgroup.nospam@virtualinfinity.net> - 2012-07-01 12:45 -0700
  Re: Overriding JComponent or implementing ComponentUI? "John B. Matthews" <nospam@nospam.invalid> - 2012-07-01 20:11 -0400
  Re: Overriding JComponent or implementing ComponentUI? Roedy Green <see_website@mindprod.com.invalid> - 2012-07-05 07:40 -0700
    Re: Overriding JComponent or implementing ComponentUI? "John B. Matthews" <nospam@nospam.invalid> - 2012-07-05 21:11 -0400
  Re: Overriding JComponent or implementing ComponentUI? "John B. Matthews" <nospam@nospam.invalid> - 2012-07-05 21:06 -0400
  Re: Overriding JComponent or implementing ComponentUI? Daniele Futtorovic <da.futt.news@laposte-dot-net.invalid> - 2012-07-10 01:42 +0200
    Re: Overriding JComponent or implementing ComponentUI? Lew <noone@lewscanon.com> - 2012-07-09 23:30 -0700
      Re: Overriding JComponent or implementing ComponentUI? Daniele Futtorovic <da.futt.news@laposte-dot-net.invalid> - 2012-07-10 20:18 +0200
        Re: Overriding JComponent or implementing ComponentUI? Lew <lewbloch@gmail.com> - 2012-07-10 13:25 -0700

csiph-web