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


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

Re: Overriding JComponent or implementing ComponentUI?

Path csiph.com!usenet.pasdenom.info!news.albasani.net!.POSTED!not-for-mail
From Lew <noone@lewscanon.com>
Newsgroups comp.lang.java.gui
Subject Re: Overriding JComponent or implementing ComponentUI?
Date Mon, 09 Jul 2012 23:30:48 -0700
Organization albasani.net
Lines 27
Message-ID <jtgi6o$va0$1@news.albasani.net> (permalink)
References <kN1Ir.59786$GJ4.56436@newsfe16.iad> <jtfqbg$4uo$1@dont-email.me>
Mime-Version 1.0
Content-Type text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding 7bit
X-Trace news.albasani.net we0732cPCjeJ7A9ZgfBHEYycplPCI1gb86K3ZBZ/iMRdzDZmDtp8uk4I1S2kKt7/1RquY3v65atJROxx52Ywc6omq/CsNN3gLIPUYuqKRxC+n8HvqPneMM1bxle6xux1
NNTP-Posting-Date Tue, 10 Jul 2012 06:30:48 +0000 (UTC)
Injection-Info news.albasani.net; logging-data="TMDqAwiObf69Y7U21aL3A7koro7PEIACrc8jJkmDcitHurASOz9/wMZPE5/ODZMadF35+BfVbxZ1yE5SPrcmI5w+Z76cm65RlwsbxgnEsFLjwm8XVuH20qp4n/27tosw"; mail-complaints-to="abuse@albasani.net"
User-Agent Mozilla/5.0 (X11; Linux x86_64; rv:13.0) Gecko/20120615 Thunderbird/13.0.1
In-Reply-To <jtfqbg$4uo$1@dont-email.me>
Cancel-Lock sha1:c4OmgyTCkre/5GC/DMctebG0Wr0=
Xref csiph.com comp.lang.java.gui:5193

Show key headers only | View raw


Daniele Futtorovic wrote:
> FWIW (as it's been a while I've done GUI code), the more complex and
> specialised custom components I wrote, the further I lent towards
> ComponentUIs. Unfortunately, I don't remember any exact benefit. Perhaps
> a matter of cleanness and encapsulation (as it feels "more right" to put
> that code in a dedicated place, rather than overriding stuff in the
> component). There's also the issue of shared resources, although those
> can be dealt with similarly in JComponent.
>
> I realise that was a terribly useless post. Sorry about that. :)

Honestly, I thought it was going to be useless for a second, but it turned out 
to be rather thought-provoking and best-practice oriented.

Assuming I understood your remarks correctly.

Josh Bloch says, "Prefer composition to inheritance."

In GUI terms this translates to, "Usually you have a JFrame as a member rather 
than as a supertype."

-- 
Lew
Honi soit qui mal y pense.
http://upload.wikimedia.org/wikipedia/commons/c/cf/Friz.jpg

Back to comp.lang.java.gui | Previous | NextPrevious in thread | Next 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