Win a copy of Learning OpenStack Networking: Build a solid foundation in virtual networking technologies for OpenStack-based clouds this week in the Cloud/Virtualization forum!
  • 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Liutauras Vilda
  • Campbell Ritchie
  • Tim Cooke
  • Bear Bibeault
  • Devaka Cooray
Sheriffs:
  • Jeanne Boyarsky
  • Knute Snortum
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Ganesh Patekar
  • Stephan van Hulst
  • Pete Letkeman
  • Carey Brown
Bartenders:
  • Tim Holloway
  • Ron McLeod
  • Vijitha Kumara

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

 
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.
 
Sheriff
Posts: 21453
96
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!