go_mango

Greenhorn
+ Follow
since Feb 28, 2000
Merit badge: grant badges
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by go_mango

I just passed my copy of Just Java to a friend brand new to programming. It was the first book I bought on java and though I outgrew it in a few months, it was a great introduction to java.
22 years ago
Another way to think of constructor chaining: I use a model of the grounding of electric circuits. But ofcoarse, it is a grounding of constructor calls.
Appears that constructor chaining between superclass and subclass is quite a bit like overriding, that is; the constructor signatures must match. I think of this chaining like grounding.
IF so AND an explicit constructor is written
AND an implicit no-arg constructor is not provided (as is the case)
THEN, a subclass can only chain to its superclass constructor thru the constructor signatures provided. In the case above, the no-arg constructor is not grounded, that is not connected to a superclass constructor.

[This message has been edited by go_mango (edited April 04, 2000).]
As Jesper noted, the method to call is repaint which calls update which eventually calls paint. The manner in which the JVM provides the Graphics reference is not all clear to me, and then there is the thing called a 'graphics context'. Well, I suspect the graphics context is just a way of saying that (my words) 'the paint method being passed a reference of type graphics, provides a context in which to direct the graphical display of a component (of which method paint is a member). This looks like a good example of delegation. The component delegates all of its graphical manipulation to some hidden object accessed through the reference passed to the method void paint(Graphics g).
The reference of type Graphics allows access to all of the abstract methods in the Graphics class. (Java2 API doc is worth a peak). The methods manage the graphical state of the component.
To use the Graphics methods, place calls to them from a components' paint method, but you don't call paint directly. As Jesper noted, invoke the method repaint and it will in turn call update which eventually calls paint and runs the Graphics methods invoked within paint's body.
22 years ago