• Post Reply Bookmark Topic Watch Topic
  • New Topic

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

 
James Nelson
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 20817
68
Chrome Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!