Programming C, C++, Java, PHP, Ruby, Turing, VB
Computer Science Canada 
Programming C, C++, Java, PHP, Ruby, Turing, VB  

Username:   Password: 
 RegisterRegister   
 Question on Applets and Swing
Index -> Programming, Java -> Java Help
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
nicky9door




PostPosted: 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 Very Happy
Sponsor
Sponsor
Sponsor
sponsor
rizzix




PostPosted: Tue Jul 31, 2007 1:08 am   Post subject: RE:Question on Applets and Swing

no it's paint()...
nicky9door




PostPosted: 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




PostPosted: 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!
Display posts from previous:   
   Index -> Programming, Java -> Java Help
View previous topic Tell A FriendPrintable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic

Page 1 of 1  [ 4 Posts ]
Jump to:   


Style:  
Search: