• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Can anyone tell me how to draw something(example: circle,lines ) on an image ?

 
motress zlting
Ranch Hand
Posts: 55
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Can anyone tell me how to draw something(example: circle,lines ) on an image ?

1.Browse an image in local laptop,
2.Display it,
3.Draw something on that image.....

what should i use so that i can draw on image ?
Canvas ? JFrame ? Frame ?
 
salvin francis
Bartender
Posts: 1306
10
Eclipse IDE Google Web Toolkit Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
As suggested in the other posts by me, have you looked at the java2d api ?

You can use Canvas/JFrame/Frame to draw the points. though Frame is a part of awt and you are better off with JFrame/Canvas for your requirement.
Please do go through basic code for java2d/awt/swing before trying out complex examples.
 
Ulf Dittmer
Rancher
Posts: 42968
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Here's an example to get you started: http://www.exampledepot.com/egs/javax.imageio/BasicImageRead.html
 
motress zlting
Ranch Hand
Posts: 55
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
salvin francis wrote:As suggested in the other posts by me, have you looked at the java2d api ?

You can use Canvas/JFrame/Frame to draw the points. though Frame is a part of awt and you are better off with JFrame/Canvas for your requirement.
Please do go through basic code for java2d/awt/swing before trying out complex examples.


i have go through it, but i cannot find any info that can let me draw something on an image.....T.T Urgent ...
 
Ulf Dittmer
Rancher
Posts: 42968
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
There's nothing special about drawing on an image. First you'd draw the image on the panel or frame, and then everything else on top of that. The Graphics (and Graphics2D) object that gets passed into your paintComponent method has methods to draw images and graphics primitives.

As is so often the case, the Sun Java Tutorial explains it all: http://java.sun.com/docs/books/tutorial/uiswing/painting/index.html
 
Rob Spoor
Sheriff
Pie
Posts: 20610
63
Chrome Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
motress zlting wrote:Urgent ...

Please EaseUp.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic