Extending JPanel or JComponent?

Hi,just a short question: when should my class, which uses a paintComponent method, extends JPanel and when JComponent?Thanks!
[147 byte] By [SFL] at [2007-11-26 12:16:52]
# 1

All custom components in Swing extend JComponent.

JPanel extends JComponent. The basic functionality it adds it the painting of the background.

So since you are doing custom painting I would suggest you don't need to extend JPanel for that feature, you can add that support yourself. Then when you create your object its more efficient since the JVM doesn't need to create a JPanel object.

camickr at 2007-7-7 14:53:33 > top of Java-index,Archived Forums,Socket Programming...