aspose file tools
The moose likes Java in General and the fly likes Can anyone tell me how to draw something(example: circle,lines ) on an image ? Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


Win a copy of The Mikado Method this week in the Agile and other Processes forum!
JavaRanch » Java Forums » Java » Java in General
Reply Bookmark "Can anyone tell me how to draw something(example: circle,lines ) on an image ?" Watch "Can anyone tell me how to draw something(example: circle,lines ) on an image ?" New topic
Author

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

motress zlting
Ranch Hand

Joined: Jan 10, 2010
Posts: 55
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
Ranch Hand

Joined: Jan 12, 2009
Posts: 915

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.


My Website: [Salvin.in] Cool your mind:[Salvin.in/painting] My Sally:[Salvin.in/sally]
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 35237
    
    7
Here's an example to get you started: http://www.exampledepot.com/egs/javax.imageio/BasicImageRead.html


Android appsImageJ pluginsJava web charts
motress zlting
Ranch Hand

Joined: Jan 10, 2010
Posts: 55
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
Marshal

Joined: Mar 22, 2005
Posts: 35237
    
    7
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

Joined: Oct 27, 2005
Posts: 19216

motress zlting wrote:Urgent ...

Please EaseUp.


SCJP 1.4 - SCJP 6 - SCWCD 5
How To Ask Questions How To Answer Questions
 
I agree. Here's the link: http://ej-technologies/jprofiler - if it wasn't for jprofiler, we would need to run our stuff on 16 servers instead of 3.
 
subject: Can anyone tell me how to draw something(example: circle,lines ) on an image ?
 
Similar Threads
How do you draw in a frame?
drawing circle with label inside
Drawing
How to manipulate the image
image transperancy