Re: New to OOP and polymorphism

From: Stephen (sedelblut_at_hotmail.com)
Date: 02/24/04


Date: Tue, 24 Feb 2004 00:32:20 GMT


> 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?



Relevant Pages

  • Re: Has working with raster graphics always been this complicated?
    ... I'm not new to programming, but I'm new to Java, at least as far as ... I find references to Image objects, Graphics ... You can draw primitives on ... those transparent pixels. ...
    (comp.lang.java.help)
  • Re: Ignored advice, am now in serious poo on graphics
    ... Then I put in a thread.sleep, after the draw in the Paint method, and noticed a strange thing - the image was shown for 1000 milliseconds, then disappears. ... If you're doing your own drawing, there's nothing in a PictureBox control that is useful to you. ... It would take a lot more than a single newsgroup post to address all of the complexities of graphics under Windows. ...
    (microsoft.public.dotnet.languages.csharp)
  • Re: problems with flips/rotations of certain shapes
    ... Always draw as if you were drawing to an untransformed graphics device. ... > With some shapes, such as a curve, they 'walk' across the screen as ...
    (microsoft.public.dotnet.framework.drawing)
  • Re: can one convert drawable XmlSerializer xmlns file into GIF or PNG?
    ... >>> metafile with commands used to draw images. ... >> is there a method to draw the graphics? ... >> mentions a Draw routine which takes a Graphics object as a parameter. ... I suggest you read up on XML first. ...
    (microsoft.public.dotnet.languages.vb)
  • Re: Linux gForth/VFX windows
    ... horizontal nib (3 pixels) ... Draw a circle segment. ... These are hardware coordinates. ... In graphics mode EMIT, TYPE etcetera still work, but now they ...
    (comp.lang.forth)