Re: New to OOP and polymorphism
From: Ryan Stewart (zzanNOtozz_at_gSPAMo.com)
Date: 02/24/04
- Next message: Ryan Stewart: "Re: struts javascript validator message problem"
- Previous message: jAnO!: "Re: Best java development tool"
- In reply to: Stephen: "Re: New to OOP and polymorphism"
- Next in thread: Stephen: "Re: New to OOP and polymorphism"
- Reply: Stephen: "Re: New to OOP and polymorphism"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Tue, 24 Feb 2004 06:46:42 -0600
"Stephen" <sedelblut@hotmail.com> wrote in message
news:oYw_b.18810$hm4.784@newsread3.news.atl.earthlink.net...
> > public void paint( Graphics g )
> > {
> > Shape2D aShape = new Circle( x, y, radius, fillColor );
> > aShape.draw();
> > }
> >
> > Like that?
>
>
> Sorry, my mistake. What I meant was, what do I put in the Shape2D and in
the
> draw method class to make it draw on the JFrame client program using the
> circle, square, and triangle classes - and any others I want to add later,
> hence the whole idea object-oriented programming. Doing { public Graphics
> draw() {} } does not work. Then in the client doing g.paint(
> aShape.draw() ). ????? Anyone understand what I mean?
>
Check out the code I posted here:
http://www.google.com/groups?&selm=BLednRbFT-DUzoXd4p2dnA%40texas.net&rnum=3
It's a basic example of what you're trying to do. The Circle class is like
your Shape2D class. It's a shape that knows how to draw itself on the
screen. It's sparse on the comments, but just ask if you have questions. If
you'd like to email me about it, remove NO and SPAM from my email address.
- Next message: Ryan Stewart: "Re: struts javascript validator message problem"
- Previous message: jAnO!: "Re: Best java development tool"
- In reply to: Stephen: "Re: New to OOP and polymorphism"
- Next in thread: Stephen: "Re: New to OOP and polymorphism"
- Reply: Stephen: "Re: New to OOP and polymorphism"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]