Article View: aus.computers.java
Article #831Re: New to Java
From: Mad Dog
Date: Wed, 03 May 2000 00:00
Date: Wed, 03 May 2000 00:00
50 lines
1978 bytes
1978 bytes
g is the instance of an object of type Graphics
for example
if i declare
String myString = "cool";
i have just created an attribute of type String.
with that attribute comes all sorts of methods i can call because of
this fact.
eg
myString.charAt(2); // returns 'o'
this is because the class String has this method, and myString is of
type String.
so it is a similar thing with g
paint is passed a parramater of type Grapgics, you can then access all
those cool methods that come with an attribute of type g such as
drawString().
did that help?
David Belavy wrote:
> Hello Everyone,
>
> I'm learning to program from the Deitel & Deitel book and I was just
> wondering what the 'g' means in
>
> public void paint (Graphics g)
> {
> g.drawString("String", 25,25);
> }
>
> What does the g actually refer to?
>
> Thanks,
>
> David
--
|\
____|@\
____/0 \
/ \
<----- \
\______ \
\=#=#=#=#=\_____________________________
| |\
| Final year Bach Applied Science (CS)|\\
| RMIT University Bundoora | \\
\ mail to: maddog100@rocketmail.com | \\
\_____________________________________| \)
Technical Details
Message-ID:
<390FD6BE.E63E4780@rocketmail.com.SPAMGUARD>Path:
arc1-ca.pugleaf.net!unknown!not-for-mailReferences:
<JfBL4.425$v85.2035@news-server.bigpond.net.au>Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 10d6db,a6c6328d2bd0994c X-Google-Attributes: gid10d6db,public From: Mad Dog <maddog100@rocketmail.com.SPAMGUARD> Subject: Re: New to Java Date: 2000/05/03 Message-ID: <390FD6BE.E63E4780@rocketmail.com.SPAMGUARD> X-Deja-AN: 618593564 Content-Transfer-Encoding: 7bit References: <JfBL4.425$v85.2035@news-server.bigpond.net.au> X-Accept-Language: en Content-Type: text/plain; charset=us-ascii X-Trace: newsfeeds.bigpond.com 957338337 139.134.76.39 (Wed, 03 May 2000 17:18:57 EST) Organization: RMIT MIME-Version: 1.0 NNTP-Posting-Date: Wed, 03 May 2000 17:18:57 EST Newsgroups: aus.computers.java