Class JMapStatusBar

All Implemented Interfaces:
ImageObserver, MenuContainer, Serializable, Accessible

public class JMapStatusBar extends JPanel
A status bar that works with a map pane to display cursor coordinates and other data. The static createDefaultStatusBar(org.geotools.swing.MapPane) method can be used for the most common configuration.
Since:
8.0
Author:
Michael Bedward
See Also:
  • Constructor Details

    • JMapStatusBar

      public JMapStatusBar()
      Creates a new status bar. Sets a MigLayout layout manager and adds the default config menu status item.
  • Method Details

    • createDefaultStatusBar

      public static JMapStatusBar createDefaultStatusBar(MapPane mapPane)
      Creates a new status bar, with the default set of items, linked to the given map pane. This method can be called safely from any thread.

      The default items are:

      • cursor coordinate item
      • map extent item
      • coordinate reference system item
      • rendering activity item
      Parameters:
      mapPane - the map pane linked to the status bar
      Returns:
      a new status bar
      Throws:
      IllegalArgumentException - if mapPane is null
    • addItem

      public boolean addItem(StatusBarItem item)
      Adds a new item to the status bar. The item will display a border and appear in the status bar configuration menu. If the item is already present in the status bar it will not added again and the method will return false.
      Parameters:
      item - the item to add
      Returns:
      true if the item was added
    • addItem

      public boolean addItem(StatusBarItem item, boolean configurable, boolean showing)
      Adds a new item to the status bar. If the item is already present in the status bar it will not added again and the method will return false.
      Parameters:
      item - the item to add
      configurable - whether the item should appear in the status bar configuration menu
      showing - whether the item should be shown initially
      Returns:
      true if the item was added
    • getNumItems

      public int getNumItems()
      Gets the number of items in this status bar including the default configuration menu item.
      Returns:
      number of status bar items
    • findItem

      public int findItem(StatusBarItem item)
      Searches for the given item in the current set of status bar items. If found, the item's position index is returned; otherwise -1.
      Parameters:
      item - the item to search for
      Returns:
      position index or -1 if not found
    • getItem

      public StatusBarItem getItem(int index)
      Gets the item at the specified position index. Position 0 is always occupied by the status bar's configuration menu item.
      Parameters:
      index - position index between 0 and getNumItems() - 1
      Returns:
      the item
      Throws:
      IndexOutOfBoundsException - on invalid index value