Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.java.gui > #5192
| From | Daniele Futtorovic <da.futt.news@laposte-dot-net.invalid> |
|---|---|
| Newsgroups | comp.lang.java.gui |
| Subject | Re: Overriding JComponent or implementing ComponentUI? |
| Date | 2012-07-10 01:42 +0200 |
| Organization | A noiseless patient Spider |
| Message-ID | <jtfqbg$4uo$1@dont-email.me> (permalink) |
| References | <kN1Ir.59786$GJ4.56436@newsfe16.iad> |
On 01/07/2012 21:45, Daniel Pitts allegedly wrote: > Hello Swing programmers. > > I'm going to try to make a few custom components. Specifically histogram > and heat maps. Heat maps meaning histograms over time plots. > > I know there are probably existing libraries which do this, and I will > investigate using them too, but for my use-case I may need more > flexibility then they afford. In any case, I also enjoy implementing > these kinds of things as a learning exercise. > > So, in the past I've always implement custom views by extends JComponent > and overriding the paintComponent method. That works fairly well, but > then I noticed that there is the ComponentUI classes and subclasses. > > Does anyone have any experience with implementing ComponentUI classes? > It seems to be part of the PLAF architecture, and since this isn't > really a look-and-feel configurable component, it seems like that may be > overkill. > > Actually, I think I've answered my own question, but I'll post this > anyway to encourage discussions :-) > > Feedback and suggestions on libraries to use instead is welcome. Thanks. > > > Thanks, > Daniel. 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. :) -- DF.
Back to comp.lang.java.gui | Previous | Next — Previous in thread | Next in thread | Find similar
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