IntelliJ Java IDE
The moose likes Game Development and the fly likes Frustrated with drawing shapes programmtically? Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login
JavaRanch » Java Forums » Java » Game Development
Reply Bookmark "Frustrated with drawing shapes programmtically? " Watch "Frustrated with drawing shapes programmtically? " New topic
Author

Frustrated with drawing shapes programmtically?

omi sharma
Ranch Hand

Joined: Mar 18, 2008
Posts: 489
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

best regards,
omi


SCJP, OCA 9i application developer, SCWCD 5.
When I was in hell someone told me to get heaven you need to do Java.
Fred Hamilton
Ranch Hand

Joined: May 13, 2009
Posts: 679
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.



omi sharma
Ranch Hand

Joined: Mar 18, 2008
Posts: 489
Fred Hamilton wrote:
Are you using draw and fill commands from the Graphics class and using them in a paint or paintComponent method of a JPanel?


yea , this is what I am doing.

thanks your tips.

best regards,
Omi
 
IntelliJ Java IDE
 
subject: Frustrated with drawing shapes programmtically?
 
Threads others viewed
Wanted: How to use Strategy Pattern with Shapes?
How interfaces are used for code reusability
Swing GUI
Drawing non-standard shapes in MIDP 2.0
Adding a custom component to a layout?
developer file tools