| Programming with JViews Maps > Creating a Map Application Using the API > Using the GUI Beans > Scale Control Bar |
Scale Control Bar |
INDEX
PREVIOUS
NEXT
|
The Scale Control Bar Bean is represented by the IlvJMapScaleControl class. This Bean enables users to see the scale of the map. The
button also enables users to control the scale interactively by entering a new setting.
An example of the Scale Control Bar is shown in Figure 3.5.
To include the Scale Control Bar Bean in your application, write the following lines of code:
IlvJMapScaleControl scaleControl = new IlvJMapScaleControl(); scaleControl.setView(view);
You can then add this Bean in your Swing hierarchy.
panel.add(scaleControl, BorderLayout.SOUTH);
The Scale Control Bar Bean then attaches itself and listens for scale changes for the view in order to update the displayed scale.
You can prevent users from entering changes to the map scale by means of this Bean (this makes the Control Scale button disappear) using:
scaleControl.setAllowScaleEdition(false);
If the way the scale is presented is not appropriate for your needs, many tools are provided to change the prefix ("1/"), suffix, or even the number formatter:
scaleControl.setPrefix(null);
scaleControl.setSuffix("th");
scaleControl.setScaleFormat(new DecimalFormat());
| Copyright © 1987-2007 ILOG S.A. All rights reserved. Documentation homepage. Legal terms. | PREVIOUS NEXT |