• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Extending the Shape class

 
Ranch Hand
Posts: 47
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Guys,

Is there anyway of extending the Shape class.
I want to draw a circle with a sqiggle in it - to represent a generator.

I need to implement this as a Shape as I want to be able to affine transform it with code similar to the one below.

Shape transformedCircle = new Path2D.Double(circle0, atf);
In this case I want my own Shape instead of the circle circle0.

Kind regards,

Apprentice
 
Marshal
Posts: 79239
377
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
By Shape, do you mean java.awt.Shape? That's not a class but an interface. Path2D.Double already implements Shape, and it isn't "final" so you can extend it in the usual fashion.
[ July 20, 2008: Message edited by: Campbell Ritchie ]
 
Sheriff
Posts: 22784
131
Eclipse IDE Spring VI Editor Chrome Java Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You could extend Ellipse2D similar to Ellipse2D.double, but you have to ask yourself how you should override some of the methods. Especially getPathIterator could be a problem.
reply
    Bookmark Topic Watch Topic
  • New Topic