The professional, friendly Java community. 21,500 members and growing!

The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.

How to Simplify my code ?

These points are cubic curves coordinates used by java Graphics2D libraries to draw high quality shapes such as svg the path took from Inkscape Please Help me programmatically how to put these points in array,collection to remove the hardcode by reading each point to read them all at once instead of substitute each curve individually the code is :

Re: How to Simplify my code ?

i want to remove the hardcode by reading each point, i thought about array to remove the complexity in my code,but i am not sure because path.curveTo() Adds a curved segment, defined by three new points, to the path by drawing a Bézier curve that intersects both the current coordinates and the specified coordinates (x3,y3), using the specified points (x1,y1) and (x2,y2) as Bézier control points. All coordinates are specified in double precision. Overrides: curveTo(...) in Path2D
Parameters: x1 the X coordinate of the first Bézier control point y1 the Y coordinate of the first Bézier control point x2 the X coordinate of the second Bézier control point y2 the Y coordinate of the second Bézier control point x3 the X coordinate of the final end point y3 the Y coordinate of the final end point
Any suggestion to simplify my code because i have other shapes the have so many coordinates ? And how to use collection class with Shapes?

--- Update ---

I got this answer
"Create a Bezier class (inheriting from an abstract Shape), which holds all three co-ordinates. You can then build a collection of Bezier objects and create your graphics from that."
How to implement that programmatically ?
Thanks

Re: How to Simplify my code ?

It appears you've posted the request for help in multiple places, known as cross posting. Cross posting is okay here, but it is requested that you provide a link to the other post(s).

I recommend that you direct follow-up questions to the person who gave you the suggestion.

You never answered my question, and here's another one: Do you mean to say that you do not know how to create a class with 3 fields for coordinates?

If you already have the coordinates, why not copy/paste them to a file and read them from there? Data is data and you've given no valid reason to "shorten" the data, and you probably don't want to. However, handling the data programmatically can be generalized so that the program doesn't just work for a specific, hardcoded case.