Re: How many warnings is too many?



ricky.clarkson@xxxxxxxxx <ricky.clarkson@xxxxxxxxx> wrote:
> Thomas,
>
> > For normal uses
> > there is no point extending JPanel. But banning a component extending
> > JComponent is absurd.
>
> To my eyes, the main difference between JPanel and JComponent is that
> JPanel is opaque by default. I might have missed something. So I will
> read your text as if you said JPanel twice and omitted JComponent..
>
> What you say is true only if abnormal uses are justified. What are
> these abnormal uses?

There's a difference of intent that matters. JPanel is intended to be
used as a container for other components, and not contain a lot of logic
of its own. I'm certain that's what Thomas meant. No point in
extending when you're just going to add children... but there is a point
in extending if you're implementing a true custom component.

The fact that custom components sometimes extend JPanel, or that
JComponent is technically a container, is irrelevant.

--
www.designacourse.com
The Easiest Way To Train Anyone... Anywhere.

Chris Smith - Lead Software Developer/Technical Trainer
MindIQ Corporation
.



Relevant Pages

  • Re: Creating a component by putting together others
    ... components inside a JPanel, ... write my custom component by extending a JPanel with two private ... sensible or should I extend JComponent? ... Your custom component does not offer funtionality on its own, ...
    (comp.lang.java.gui)
  • Re: How do i know which superclass to inherit from...
    ... class that extends nothing and constructs the elaborate JFrame. ... This is a pane, so it can be included somewhere in a dialog, so it must be a JPanel (which is my reasoning for extending JPanel: it's ultimately a JComponent, and JPanel is the most convenient for me to extend). ... I make my panes components because I see them as atomic, indivisible visual areas which are logically connected and can be independently used and manipulated. ...
    (comp.lang.java.programmer)
  • Re: Creating a component by putting together others
    ... pathname, and a JButton next to it to launch a Choose File Dialog. ... components inside a JPanel, ... Extending JPanel is probably the easiest way to ...
    (comp.lang.java.gui)
  • Re: Creating a component by putting together others
    ... components inside a JPanel, ... write my custom component by extending a JPanel with two private ... sensible or should I extend JComponent? ... Your custom component does not offer funtionality on its own, ...
    (comp.lang.java.gui)
  • Re: Newbie question
    ... > The extending style I think is less error prone. ... > keep specifying which panel you mean over and over. ... JPanel. ... "MyEmailProgram ...
    (comp.lang.java.gui)