简体   繁体   中英

java applet parameter overwriting

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?

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM