private void scaleImage() {
   Image img =
       back.getScaledInstance(scx(back.getWidth()), scy(back.getHeight()), Image.SCALE_SMOOTH);
   back =
       new BufferedImage(img.getWidth(null), img.getHeight(null), BufferedImage.TYPE_INT_ARGB);
   Graphics g = back.getGraphics();
   g.drawImage(img, 0, 0, null);
   g.dispose();
 }
  private void Timer(ActionEvent evt) {
    // TODO Auto-generated method stub
    try {
      int minBus = 110;
      int maxBus = 120;
      double minAfkLat = 42.302;
      double maxAfkLat = 42.304;
      System.out.println("Timer");
      timer.stop();
      MapMarker init = new MapMarker(theLatitude, theLongitude);
      String theMapURIAsString =
          (String) MapLookup.getMap(theLatitude, theLongitude, init).substring(0, 87);
      int testint2 = 0;
      for (Listener l : theListeners) {
        // if(l.Latitude != 9999 && Float.parseFloat(l.BusID.split("#")[1]) < maxBus &&
        // Float.parseFloat(l.BusID.split("#")[1]) > minBus)    //Bussar beroende på buss nummer
        // if(l.Latitude != 9999 && l.Latitude > minAfkLat && l.Latitude < maxAfkLat)
        // //Possible afk busses
        // if(l.Latitude != 9999 && ( l.Latitude < minAfkLat || l.Latitude > maxAfkLat))
        // //Exclude afk busses
        if (l.Latitude != 9999.0) // All busses
        {
          theMapURIAsString += "|";
          theMapURIAsString += Float.toString(l.Latitude) + "," + Float.toString(l.Longitude);
        }
      }
      theMapURIAsString += "&sensor=false&key=AIzaSyBR_wUAQ3iPM2e8WeoQIUw9c3xLJPRGZL8";
      // System.out.println("HEIR COWMES F****R\n" + theMapURIAsString + "\nFUCKER IS COMMEN");

      String[] GetRidOfinitMarker = theMapURIAsString.split("42.358543,-71.096178\\|");
      // String[] GetRidOfinitMarker = theMapURIAsString.split("42.303113,-71.109925\\|"); //afk
      // bussar
      String GottenRidOfinitMarker = GetRidOfinitMarker[0] + GetRidOfinitMarker[1];

      String test = theMapURIAsString.split("&markers=")[1];
      String[] testa = test.split("\\|");
      // for(String v : testa)System.out.println(v);  //alla inkomna positioner
      // Retrieve map from Google Maps.
      // URL theMapURI = new URL(theMapURIAsString);
      URL theMapURI = new URL(GottenRidOfinitMarker); // URL Utan init marker
      theMap = ImageIO.read(theMapURI.openStream());

      // Create map image scaled to size of the application window size.
      imagePanel1.setImage(
          theMap.getScaledInstance(
              imagePanel1.getWidth(), imagePanel1.getHeight(), Image.SCALE_AREA_AVERAGING));

      // Display map image.
      imagePanel1.repaint();
    } catch (Exception ex) {
      timer.start();
    }
    timer.start();
  }