tags:

views:

65

answers:

1

I have developed a map applet that has JLabels on it. The JLabels get their X/Y coordinate values from an applet parameter file in order to be shown on the map in an exact position.

The problem is:
The map applet normally runs on a big LCD screen but some clients want to view the map in their browsers too. The issue with this is that the applet is being loaded from a server to the client's browser and it should always connect to the server so they can't run the applet locally. In this case, X/Y coordinates shift a little bit on map.

One solution may be to create two versions of the applet -- one for the LCD and one for client computers. But is there any option to use local parameter file for clients?

A: 

As far as I understand, you can determine the type of display programatically. So you can just pass 4 parameters to the applet instead of 2 - x, y, xLcd, yLcd, and use the appropriate ones (with a simple if-statement in the applet). But better try to analyze what causes that shift, because it should not happen in the first place. Or ask a question (giving more details) - why is the shift happening.

Bozho
shift happens because of screen resolution
soField
Yes, but what 'shit' exactly - if it is because of different ratio, then you could easily recalculate the coordinates based on the current resolution ratio.
Bozho
how can ? i only saving x,y coordinates
soField
http://www.exampledepot.com/egs/java.awt/screen_ScreenSize.html
Bozho