There's the detail.

Kaart= BoxLayout.encloseYCenter(cnt);

BoxLayout.Y sizes components according to their preferred height.  Easiest
to embed the MapContainer in a BorderLayout center, because that will
stretch it out.  Alternatively, if you want to use a BoxLayout, you can
explicitly provide a preferred size for the MapContainer using
setPreferredH() and setPreferredW().

Steve

On Thu, Sep 19, 2019 at 2:30 PM Peter Bell <[email protected]> wrote:

>
> The code is
>
> public void start()  {
>
>         l= 0;
>
>
>         if(current != null){
>             current.show();
>             return;
>         }
>
>         hi = new Form("TalkingGps", new BorderLayout());
>      MapContainer    cnt = new MapContainer();
>
>      //         cnt = new MapContainer(provider);
>         //       String tileLayer= "http://t1.openseamap.org/seamark/";;
>
>      //        cnt.addTilelayer(tileLayer);
>
>
>         cnt.addLongPressListener(new ActionListener() {
>
>             public void actionPerformed(ActionEvent evt) {
>                t.setSelectedIndex(0);
>
>             }
>         });
>
>
>
>                Kaart= BoxLayout.encloseYCenter(cnt);
>
>
>
>
>
>
>             cnt.addTapListener(new ActionListener() {
>
>             public void actionPerformed(ActionEvent evt) {
>
>                 if ((routenw  == true)) {
>               int x = evt.getX()-cnt.getAbsoluteX(); ;
>                int y = evt.getY()-cnt.getAbsoluteY();
>                Coord positie = cnt.getCoordAtPosition(x,y);
>                double Latt = positie.getLatitude();
>                double Lonn = positie.getLongitude();
>                nwrtetabel(Latt,Lonn);
>                try {
>
>                   cnt.addMarker(EncodedImage.create("/maps-pin2.png"),
> positie , "Marker At","punt", new ActionListener() {
>                   public void actionPerformed(ActionEvent evt) {
>                   Dialog.show("Marker At", "Marker At" , "OK", null);
>                  }
>                  });
>                     Integer zm = 17;
>                     cnt.zoom(new Coord(Latt, Lonn ), zm);
>                      cnt.setShowMyLocation(true);
>                      markerLookup.put(1,"punt");
>                  } catch(IOException err) {
>             // since the image is iin the jar this is unlikely
>              err.printStackTrace();
>                 }
>
>              } else if (addm == true ) {
>                addm =  false ;
>                int x = evt.getX()-cnt.getAbsoluteX(); ;
>                int y = evt.getY()-cnt.getAbsoluteY();
>                Coord positie = cnt.getCoordAtPosition(x,y);
>                double Latt = positie.getLatitude();
>                double Lonn = positie.getLongitude();
>                nwrtetabel(Latt,Lonn);
>                try {
>
>                   cnt.addMarker(EncodedImage.create("/maps-pin.png"),
> positie , "Marker At","punt", new ActionListener() {
>                   public void actionPerformed(ActionEvent evt) {
>                   Dialog.show("Marker At", "Marker At" , "OK", null);
>                  }
>                  });
>                     Integer zm = 17;
>                     cnt.zoom(new Coord(Latt, Lonn ), zm);
>                      cnt.setShowMyLocation(true);
>                      markerLookup.put(1,"punt");
>                  } catch(IOException err) {
>             // since the image is iin the jar this is unlikely
>              err.printStackTrace();
>                 }
>                    }
>
>
>             }
>             }  );
>
>
>                hi.addComponent(BorderLayout.CENTER, Kaart );
>          hi.show();
>
>        }
>
> --
> You received this message because you are subscribed to the Google Groups
> "CodenameOne Discussions" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/codenameone-discussions/a37b1731-929d-49fc-ae68-22d71b68e5f9%40googlegroups.com
> .
>


-- 
Steve Hannah
Software Developer
Codename One
http://www.codenameone.com

-- 
You received this message because you are subscribed to the Google Groups 
"CodenameOne Discussions" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/codenameone-discussions/CAGOYrKWZLgQ8A43FYz1cs9teKQFSyH-D%2Br_D1QZk8y6YjHtqEg%40mail.gmail.com.

Reply via email to