Win a copy of Learn Spring Security (video course) this week in the Spring forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Frustrated with drawing shapes programmtically?

 
Bobby Sharma
Ranch Hand
Posts: 598
3
Google App Engine jQuery Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
Fred Hamilton
Ranch Hand
Posts: 684
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.



 
Bobby Sharma
Ranch Hand
Posts: 598
3
Google App Engine jQuery Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic