Question on Applets and Swing
Author |
Message |
nicky9door
|
Posted: Mon Jul 30, 2007 9:04 pm Post subject: Question on Applets and Swing |
|
|
Alright, so i have dabbled in Java and know a small bit about the overall running of the language. ONe questions on applets though, I understand that it is better to extend JApplet as opposed to Applet (Swing vs AWT). My question is : why does JApplet force you to extend the paint method? Isnt the swing method for painting paintComponenet()?
Thx in advance |
|
|
|
|
|
Sponsor Sponsor
|
|
|
rizzix
|
Posted: Tue Jul 31, 2007 1:08 am Post subject: RE:Question on Applets and Swing |
|
|
no it's paint()... |
|
|
|
|
|
nicky9door
|
Posted: Mon Aug 06, 2007 1:04 pm Post subject: Re: Question on Applets and Swing |
|
|
I know that, but isnt paint() and AWT method, seems like it defeats the purpose of swing applet package |
|
|
|
|
|
Aziz
|
Posted: Tue Aug 07, 2007 10:03 am Post subject: RE:Question on Applets and Swing |
|
|
JApplet inherits from Applet. Swing still follows the same conventions as AWT (and so it should... especially when most controls inherit from AWT controls). Most Swing components inherit (directly or indirectly) from AWT's Component (JComponent does). The paint() method is what the SWING framework calls for a component to paint itself. When you override paint(), this is what is being called to draw the applet (ie show it) on the screen. If you don't override it, the applet won't be drawn! |
|
|
|
|
|
|
|