This week's book giveaway is in the Java 8 forum.
We're giving away four copies of Java 8 in Action and have Raoul-Gabriel Urma, Mario Fusco, and Alan Mycroft on-line!
See this thread for details.
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 | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Java 8 in Action this week in the Java 8 forum!
JavaRanch » Java Forums » Java » Java in General
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: 917

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: 39575
    
  27
Here's an example to get you started: http://www.exampledepot.com/egs/javax.imageio/BasicImageRead.html


Ping & DNS - updated with new look and Ping home screen widget
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: 39575
    
  27
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: 19556
    
  16

motress zlting wrote:Urgent ...

Please EaseUp.


SCJP 1.4 - SCJP 6 - SCWCD 5 - OCEEJBD 6
How To Ask Questions How To Answer Questions
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Can anyone tell me how to draw something(example: circle,lines ) on an image ?
 
Similar Threads
How do you draw in a frame?
How to manipulate the image
Drawing
image transperancy
drawing circle with label inside