This week's book giveaway is in the OO, Patterns, UML and Refactoring forum. We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma on-line! See this thread for details.
From last three days I have been trying hard to have fun with drawing shapes by coding but rather
than having fun I been getting frustrated.
For drawing shapes programmatically first thing we do is to get coordinates of the particular shape ,and then use
the coordinates in Java's API.For getting coordinates , I go to photoshop , draw some shapes ,note coordinates by the
help selection tool ,and put them into Java's API.Sometimes I get perfect shape ,sometimes I get annoying results.
Annoying outputs and wrong coordinates are making me frustrated and sulked.The one more bad thing about this is it
requires lots of time and energy.
Is there any better way do this? I mean there would be any problem if I just draw something in any graphic softwares and import
that crap into Java as an image?
I am not from math background
Most of the programming problems can't be solved because you don't know what the exact problem is.
Defining your problem correctly leads you to the right solution.
I have struggled with the same thing. Drawing effective shapes requires a certain artistic or geometric flair that I don't have.
Are you using draw and fill commands from the Graphics class and using them in a paint or paintComponent method of a JPanel?
Consider writing a generic little utility program that builds upon these draw commands. in the GUI you will have a text fields for the points, and once you have filled these fields, then you can have a JButton to repaint your JPanel. This idea would allow you to create shapes quicker and easier by saving you the trouble of changing the source code and recompiling each time. That will maybe make it quicker and more enjoyable for you to get a feel for shapes.
Hopefully that will help. Maybe someone else has a different idea.