Class JMapFrame

    • Field Detail


        public static final String TOOLBAR_INFO_BUTTON_NAME
        Name assigned to toolbar button for feature info queries.
        See Also:
        Constant Field Values

        public static final String TOOLBAR_PAN_BUTTON_NAME
        Name assigned to toolbar button for map panning.
        See Also:
        Constant Field Values

        public static final String TOOLBAR_POINTER_BUTTON_NAME
        Name assigned to toolbar button for default pointer.
        See Also:
        Constant Field Values

        public static final String TOOLBAR_RESET_BUTTON_NAME
        Name assigned to toolbar button for map reset.
        See Also:
        Constant Field Values

        public static final String TOOLBAR_ZOOMIN_BUTTON_NAME
        Name assigned to toolbar button for map zoom in.
        See Also:
        Constant Field Values

        public static final String TOOLBAR_ZOOMOUT_BUTTON_NAME
        Name assigned to toolbar button for map zoom out.
        See Also:
        Constant Field Values
    • Constructor Detail

      • JMapFrame

        public JMapFrame()
        Default constructor. Creates a JMapFrame with no map content or renderer set
      • JMapFrame

        public JMapFrame​(MapContent content)
        Constructs a new JMapFrame object with specified map content.
        content - the map content
    • Method Detail

      • showMap

        public static void showMap​(MapContent content)
        Creates a new map frame with a toolbar, map pane and status bar; sets the supplied MapContent; and displays the frame. If MapContent.getTitle() returns a non-empty string, this is used as the frame's title.

        This method can be called safely from any thread.

        content - the map content
      • enableToolBar

        public void enableToolBar​(boolean enabled)
        Sets whether to display the default toolbar (default is false). Calling this with state == true is equivalent to calling enableTool(org.geotools.swing.JMapFrame.Tool...) with all JMapFrame.Tool constants.
        enabled - whether the toolbar is required
      • enableTool

        public void enableTool​(JMapFrame.Tool... tool)
        This method is an alternative to enableToolBar(boolean). It requests that a tool bar be created with specific tools, identified by JMapFrame.Tool constants.
         myMapFrame.enableTool(Tool.PAN, Tool.ZOOM);
        Calling this method with no arguments or null is equivalent to enableToolBar(false).
        tool - tools to display on the toolbar
      • enableStatusBar

        public void enableStatusBar​(boolean enabled)
        Set whether a status bar will be displayed to display cursor position and map bounds.
        enabled - whether the status bar is required.
      • enableLayerTable

        public void enableLayerTable​(boolean enabled)
        Set whether a map layer table will be displayed to show the list of layers in the map content and set their order, visibility and selected status.
        enabled - whether the map layer table is required.
      • setVisible

        public void setVisible​(boolean state)
        Calls initComponents() if it has not already been called explicitly to construct the frame's components before showing the frame.
        setVisible in class Window
        state - true to show the frame; false to hide.
      • initComponents

        public void initComponents()
        Creates and lays out the frame's components that have been specified with the enable methods (e.g. enableToolBar(boolean) ). If not called explicitly by the client this method will be invoked by setVisible(boolean) when the frame is first shown.
      • getMapContent

        public MapContent getMapContent()
        Get the map content associated with this frame. Returns null if no map content has been set explicitly with the constructor or setMapContent(
        the current MapContent object
      • setMapContent

        public void setMapContent​(MapContent content)
        Set the MapContent object used by this frame.
        content - the map content
        IllegalArgumentException - if content is null
      • getMapPane

        public JMapPane getMapPane()
        Provides access to the instance of JMapPane being used by this frame.
        the JMapPane object
      • getToolBar

        public JToolBar getToolBar()
        Provides access to the toolbar being used by this frame. If initComponents() has not been called yet this method will invoke it.
        the toolbar or null if the toolbar was not enabled