Java Help! - Page 2 - Overclock.net

Forum Jump: 
Reply
 
Thread Tools
post #11 of 16 Old 04-10-2008, 02:43 PM
ldk
Overclocker - Duh!
 
Join Date: Mar 2005
Location: Alexandria, VA
Posts: 2,542
Mentioned: 0 Post(s)
Tagged: 0 Thread(s)
Quoted: 0 Post(s)
Liked: 368
its being called where it says

super.paintComponent(g);
ldk is offline  
Sponsored Links
Advertisement
 
post #12 of 16 Old 04-10-2008, 02:45 PM
Loading Please Wait...
 
TheLegend's Avatar
 
Join Date: Jan 2006
Location: Milwaukee, WI
Posts: 6,587
Mentioned: 0 Post(s)
Tagged: 0 Thread(s)
Quoted: 0 Post(s)
Liked: 702
Quote:
Originally Posted by ldk View Post
its being called where it says

super.paintComponent(g);
In order for it to be called you need to have the method implemented. The method isn't explicitly stated within that portion of the code.

|

Fold for 37726
Folding Team "Just Be Cause" Honorary Member
TheLegend is offline  
post #13 of 16 Old 04-10-2008, 02:48 PM
ldk
Overclocker - Duh!
 
Join Date: Mar 2005
Location: Alexandria, VA
Posts: 2,542
Mentioned: 0 Post(s)
Tagged: 0 Thread(s)
Quoted: 0 Post(s)
Liked: 368
ldk is offline  
Sponsored Links
Advertisement
 
post #14 of 16 Old 04-10-2008, 02:48 PM
Luck++
 
Join Date: Mar 2007
Location: Florida, United States
Posts: 15,198
Mentioned: 0 Post(s)
Tagged: 0 Thread(s)
Quoted: 0 Post(s)
Liked: 417
Quote:
Originally Posted by ldk View Post
its being called where it says

super.paintComponent(g);
It still never defines it's value.
Licht is offline  
post #15 of 16 Old 04-10-2008, 04:29 PM - Thread Starter
Custom User Title
 
pauldovi's Avatar
 
Join Date: Jul 2005
Location: Daytona Beach, Florida
Posts: 13,419
Mentioned: 0 Post(s)
Tagged: 0 Thread(s)
Quoted: 0 Post(s)
Liked: 923
Quote:
Originally Posted by TheLegend View Post
In order for it to be called you need to have the method implemented. The method isn't explicitly stated within that portion of the code.
That is the entire code! And there is never a graphics object created or that method called!

Quote:
Originally Posted by ldk View Post
its being called where it says

super.paintComponent(g);
There is no Graphics g. It was never created.

pauldovi is offline  
post #16 of 16 Old 04-10-2008, 05:44 PM
With great difficulty
 
Join Date: Feb 2006
Location: Pittsburgh
Posts: 5,282
Mentioned: 0 Post(s)
Tagged: 0 Thread(s)
Quoted: 0 Post(s)
Liked: 643
Quote:
Originally Posted by rabidgnome229 View Post
Java does that stuff behind the scenes. When you do something with graphics it makes a new thread which is invisible to you. Somewhere in that thread it creates the graphics object and calls paintComponent. You don't need to know the context in which it is called, but you do need to specify what happens when the call is made
Does my post not count or something? You don't see it, but it's still there. I would guess that g is initialized when the NewPanel constructor is called

The method will be called by the thread that is controlling the display (which is invisible to you by default) every time it wants to update the view. If you want to manually initialize g or manually call paintComponenet you can do so by overriding the default methods/constructors, but there is usually no reason to do so

rabidgnome229 is offline  
Reply

Quick Reply

Thread Tools
Show Printable Version Show Printable Version
Email this Page Email this Page


Forum Jump: 

Posting Rules  
You may post new threads
You may post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off