Logo 
Search:

Java Forum

Ask Question   UnAnswered
Home » Forum » Java       RSS Feeds

Image processing

  Asked By: Loretta    Date: May 30    Category: Java    Views: 632
  

i wanted to place some objects on top of an image

Image could be a geographic map and the object that i place will be something
like a building or a road etc. On click of the mouse on this object i must be
able to get the information from the database which i have.

i initially took a label and using setLocation i could place this label wherever
i want, this label can be represented with an icon of my choice.

Now the problem is if i place more than one label the label gets arranged in an
ordered manner( i think because of the default layout) even if i use setLocation
it doesn't work...

Share: 

 

3 Answers Found

 
Answer #1    Answered By: Jared Adams     Answered On: May 30

If you are going to be doing this type of image  manipulation you are
probably better off using Java 2D to draw the whole thing yourself or
perhaps you can use some other graphic toolkit on top  of 2D. I would
avoid using AWT/Swing and its layout  managers for this type of application.

 
Answer #2    Answered By: Tarrant Thompson     Answered On: May 30

here is an idea:
try to make images instead of icons, use the
g.drawImage function to locate those images over the
map and make a function that responds to the user
click on a x,y point, something like this:

//area:x,y,width,height
//i asume that u have various areas
int[][]
area={{20,20,20,20},{50,80,60,10},{10,10,10,10}};

//function returns the area clicked
//x,y are given by a mousemotionlistener

int usr_click(x,y){
int z=0;
while(z<area.length){
if(x>=area[z][0]&&x<=(area[z][0]+area[z][2])&&y>=area[z][1]&&x<=(area[z][0]+area\
[z][3])){
return(z);
}
z++;}
return(-1);//no area found, default  action
}

 
Answer #3    Answered By: Arron Lee     Answered On: Sep 17

Sorry, I have never met with such a problem before. Because I am using another image processing tool. You can google it and choose one to have a try.
http://www.rasteredge.com/how-to/csharp-imaging/

 
Didn't find what you were looking for? Find more on Image processing Or get search suggestion and latest updates.




Tagged: