equivalent for awt paint method in swing?

J

Jochen Opp

Hi,

I am currently looking to find a way to draw lines and dots etc. such as the
draw and paint methods of applet.Applet do, but not within an applet, but
within a javax.swing component.

Thanks
Jo
 
M

Michael Borgwardt

Jochen said:
Hi,

I am currently looking to find a way to draw lines and dots etc. such as the
draw and paint methods of applet.Applet do, but not within an applet, but
within a javax.swing component.

Just like Applet, Swing's JComponent is a subclass of java.awt.Component, so it
also has the paint() method. However, you shouldn't use it directly and instead
use paintComponent(). That's the only difference.
 
C

Chris Smith

Michael said:
Just like Applet, Swing's JComponent is a subclass of java.awt.Component, so it
also has the paint() method. However, you shouldn't use it directly and instead
use paintComponent(). That's the only difference.

Well, the other difference is that unless a Swing component can prove
that it will be covering the entirety of its area during painting, it
shoulod start out by calling super.paintComponent. I said this in my
response to the identical post in .help, but the OP multiposted so as to
make it more difficult to discuss the matter.

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

Chris Smith - Lead Software Developer/Technical Trainer
MindIQ Corporation
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,764
Messages
2,569,564
Members
45,039
Latest member
CasimiraVa

Latest Threads

Top