aspose file tools
The moose likes Swing / AWT / SWT and the fly likes How to draw a layer with some annotations over a big picture? Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Reply Bookmark "How to draw a layer with some annotations over a big picture?" Watch "How to draw a layer with some annotations over a big picture?" New topic
Author

How to draw a layer with some annotations over a big picture?

James Nelson
Greenhorn

Joined: Dec 22, 2009
Posts: 1
Hi
I am looking for a way to load large image files (10 MB Jpeg files) and then place some annotations over the image file using a transparent layer or something like that.
Basically I have the annotation with a coordinate in the picture which annotations should appear stored in a database, now I want to load the image and then draw those annotations on the picture.

In addition, I will need to make it possible for the users to click on annotations to open new Swing forms.

I will thankful if you let me know whether following things are possible in Java or not:

-Drawing semi-transparent panel over an image in a specific X,Y
-Adding actions like onclick action to those drawing so users can click on annotations to perform some specific actions.

If they are possible, can you please give me some heads-up about which APIs I should look for and whether any tutorial is available for doing such jobs or not.

I searched in Google and most of my findings were talking about loading icons and small images in a JLabel which I believe is not what I need as I am going to load a big file and I am looking for more features and actions.

Any suggestion and guideline is very welcome.

Thanks,

James.
Rob Spoor
Sheriff

Joined: Oct 27, 2005
Posts: 19216

1) Custom Painting in Swing. In short, you override the paintComponent method, first call super.paintComponent, then draw your annotations over the image. You should use a JLabel; this will take care of the main image itself automatically.

2) add a MouseListener to the JLabel for the clicks. The MouseEvent's getX() and getY() are relative to the top-left corner of the JLabel, and therefore of the main image.


SCJP 1.4 - SCJP 6 - SCWCD 5
How To Ask Questions How To Answer Questions
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: How to draw a layer with some annotations over a big picture?
 
Similar Threads
Inheritance nightmare.
alpha filter of an element
Canvas Conversion
Erase / Image / Canvas??
why i'm not getting graph (output)?