package com.esri.samples.mapview.scale_bar;

import javafx.application.Application;
import javafx.geometry.Insets;
import javafx.geometry.Pos;
import javafx.scene.Scene;
import javafx.scene.layout.Background;
import javafx.scene.layout.BackgroundFill;
import javafx.scene.layout.CornerRadii;
import javafx.scene.layout.StackPane;
import javafx.scene.paint.Color;
import javafx.stage.Stage;

import com.esri.arcgisruntime.UnitSystem;
import com.esri.arcgisruntime.mapping.ArcGISMap;
import com.esri.arcgisruntime.mapping.Basemap;
import com.esri.arcgisruntime.mapping.view.MapView;
import com.esri.arcgisruntime.toolkit.Scalebar;

public class ScaleBarSample extends Application {

  private MapView mapView;

  @Override
  public void start(Stage stage) {

    // create stack pane and application scene
    StackPane stackPane = new StackPane();
    Scene scene = new Scene(stackPane);

    // set title, size and scene to stage
    stage.setTitle("Scale Bar Sample");
    stage.setWidth(800);
    stage.setHeight(700);
    stage.setScene(scene);
    stage.show();

    // create a map view
    mapView = new MapView();
    ArcGISMap map = new ArcGISMap(Basemap.Type.IMAGERY, 64.1405, -16.2426, 16);
    mapView.setMap(map);

    // create a scale bar for the map view
    Scalebar scaleBar = new Scalebar(mapView);

    // specify skin style for the scale bar
    scaleBar.setSkinStyle(Scalebar.SkinStyle.GRADUATED_LINE);

    // set the unit system (default is METRIC)
    scaleBar.setUnitSystem(UnitSystem.IMPERIAL);

    // to enhance visibility of the scale bar, by making background transparent
    Color transparentWhite = new Color(1, 1, 1, 0.7);
    scaleBar.setBackground(new Background(new BackgroundFill(transparentWhite, new CornerRadii(5), Insets.EMPTY)));

    // add the map view and scale bar to stack pane
    stackPane.getChildren().addAll(mapView, scaleBar);

    // set position of scale bar
    StackPane.setAlignment(scaleBar, Pos.BOTTOM_CENTER);
    // give padding to scale bar
    StackPane.setMargin(scaleBar, new Insets(0, 0, 50, 0));
  }

  // Stops and releases all resources used in application
  @Override
  public void stop() {
    if (mapView != null) {
      mapView.dispose();
    }
  }

  // Opens and runs application
  public static void main(String[] args) {
    Application.launch(args);
  }
}

@@ -1,8 +1,594 @@
+/*%0A * Copyright 2018 Esri.%0A *%0A * Licensed under the Apache License, Version 2.0 (the %22License%22); you may not%0A * use this file except in compliance with the License. You may obtain a copy of%0A * the License at%0A *%0A * http://www.apache.org/licenses/LICENSE-2.0%0A *%0A * Unless required by applicable law or agreed to in writing, software%0A * distributed under the License is distributed on an %22AS IS%22 BASIS, WITHOUT%0A * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the%0A * License for the specific language governing permissions and limitations under%0A * the License.%0A */%0A%0A
 package 

Update ScaleBarSample.java