• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • Liutauras Vilda
  • Jeanne Boyarsky
  • paul wheaton
Sheriffs:
  • Ron McLeod
  • Devaka Cooray
  • Henry Wong
Saloon Keepers:
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
  • Tim Moores
  • Mikalai Zaikin
Bartenders:
  • Frits Walraven

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

 
Ranch Hand
Posts: 55
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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 ?
 
Bartender
Posts: 2911
150
Google Web Toolkit Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Rancher
Posts: 43081
77
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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: 43081
77
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Sheriff
Posts: 22815
132
Eclipse IDE Spring Chrome Java Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

motress zlting wrote:Urgent ...


Please EaseUp.
 
Screaming fools! It's nothing more than a tiny ad:
Gift giving made easy with the permaculture playing cards
https://coderanch.com/t/777758/Gift-giving-easy-permaculture-playing
reply
    Bookmark Topic Watch Topic
  • New Topic