Java Forum

Ask Question   UnAnswered
Home » Forum » Java       RSS Feeds

Image processing

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

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...



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:

//i asume that u have various areas

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

int usr_click(x,y){
int z=0;
return(-1);//no area found, default  action

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