public class JMapFrame extends JFrame
Simplest use is with the static showMap(MapContent)
method:
MapContent content = new MapContent();
content.setTitle("My beautiful map");
// add some layers to the MapContent...
JMapFrame.showMap(content);
MapLayerTable
,
StatusBar
,
Serialized FormModifier and Type | Class and Description |
---|---|
static class |
JMapFrame.Tool
Constants for available toolbar buttons used with the
enableTool(org.geotools.swing.JMapFrame.Tool...) method. |
JFrame.AccessibleJFrame
Frame.AccessibleAWTFrame
Window.AccessibleAWTWindow, Window.Type
Container.AccessibleAWTContainer
Component.AccessibleAWTComponent, Component.BaselineResizeBehavior, Component.BltBufferStrategy, Component.FlipBufferStrategy
Modifier and Type | Field and Description |
---|---|
static String |
TOOLBAR_INFO_BUTTON_NAME
Name assigned to toolbar button for feature info queries.
|
static String |
TOOLBAR_PAN_BUTTON_NAME
Name assigned to toolbar button for map panning.
|
static String |
TOOLBAR_POINTER_BUTTON_NAME
Name assigned to toolbar button for default pointer.
|
static String |
TOOLBAR_RESET_BUTTON_NAME
Name assigned to toolbar button for map reset.
|
static String |
TOOLBAR_ZOOMIN_BUTTON_NAME
Name assigned to toolbar button for map zoom in.
|
static String |
TOOLBAR_ZOOMOUT_BUTTON_NAME
Name assigned to toolbar button for map zoom out.
|
accessibleContext, EXIT_ON_CLOSE, rootPane, rootPaneCheckingEnabled
CROSSHAIR_CURSOR, DEFAULT_CURSOR, E_RESIZE_CURSOR, HAND_CURSOR, ICONIFIED, MAXIMIZED_BOTH, MAXIMIZED_HORIZ, MAXIMIZED_VERT, MOVE_CURSOR, N_RESIZE_CURSOR, NE_RESIZE_CURSOR, NORMAL, NW_RESIZE_CURSOR, S_RESIZE_CURSOR, SE_RESIZE_CURSOR, SW_RESIZE_CURSOR, TEXT_CURSOR, W_RESIZE_CURSOR, WAIT_CURSOR
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
DISPOSE_ON_CLOSE, DO_NOTHING_ON_CLOSE, HIDE_ON_CLOSE
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
Constructor and Description |
---|
JMapFrame()
Default constructor.
|
JMapFrame(MapContent content)
Constructs a new
JMapFrame object with specified map content. |
Modifier and Type | Method and Description |
---|---|
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.
|
void |
enableStatusBar(boolean enabled)
Set whether a status bar will be displayed to display cursor position and map bounds.
|
void |
enableTool(JMapFrame.Tool... tool)
This method is an alternative to
enableToolBar(boolean) . |
void |
enableToolBar(boolean enabled)
Sets whether to display the default toolbar (default is false).
|
MapContent |
getMapContent()
Get the map content associated with this frame.
|
JMapPane |
getMapPane()
Provides access to the instance of
JMapPane being used by this frame. |
JToolBar |
getToolBar()
Provides access to the toolbar being used by this frame.
|
void |
initComponents()
Creates and lays out the frame's components that have been specified with the enable methods
(e.g.
|
void |
setMapContent(MapContent content)
Set the MapContent object used by this frame.
|
void |
setVisible(boolean state)
Calls
initComponents() if it has not already been called explicitly to construct the
frame's components before showing the frame. |
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. |
addImpl, createRootPane, frameInit, getAccessibleContext, getContentPane, getDefaultCloseOperation, getGlassPane, getGraphics, getJMenuBar, getLayeredPane, getRootPane, getTransferHandler, isDefaultLookAndFeelDecorated, isRootPaneCheckingEnabled, paramString, processWindowEvent, remove, repaint, setContentPane, setDefaultCloseOperation, setDefaultLookAndFeelDecorated, setGlassPane, setIconImage, setJMenuBar, setLayeredPane, setLayout, setRootPane, setRootPaneCheckingEnabled, setTransferHandler, update
addNotify, getCursorType, getExtendedState, getFrames, getIconImage, getMaximizedBounds, getMenuBar, getState, getTitle, isResizable, isUndecorated, remove, removeNotify, setBackground, setCursor, setExtendedState, setMaximizedBounds, setMenuBar, setOpacity, setResizable, setShape, setState, setTitle, setUndecorated
addPropertyChangeListener, addPropertyChangeListener, addWindowFocusListener, addWindowListener, addWindowStateListener, applyResourceBundle, applyResourceBundle, createBufferStrategy, createBufferStrategy, dispose, getBackground, getBufferStrategy, getFocusableWindowState, getFocusCycleRootAncestor, getFocusOwner, getFocusTraversalKeys, getIconImages, getInputContext, getListeners, getLocale, getModalExclusionType, getMostRecentFocusOwner, getOpacity, getOwnedWindows, getOwner, getOwnerlessWindows, getShape, getToolkit, getType, getWarningString, getWindowFocusListeners, getWindowListeners, getWindows, getWindowStateListeners, hide, isActive, isAlwaysOnTop, isAlwaysOnTopSupported, isAutoRequestFocus, isFocusableWindow, isFocusCycleRoot, isFocused, isLocationByPlatform, isOpaque, isShowing, isValidateRoot, pack, paint, postEvent, processEvent, processWindowFocusEvent, processWindowStateEvent, removeWindowFocusListener, removeWindowListener, removeWindowStateListener, reshape, setAlwaysOnTop, setAutoRequestFocus, setBounds, setBounds, setCursor, setFocusableWindowState, setFocusCycleRoot, setIconImages, setLocation, setLocation, setLocationByPlatform, setLocationRelativeTo, setMinimumSize, setModalExclusionType, setSize, setSize, setType, show, toBack, toFront
add, add, add, add, add, addContainerListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getAlignmentX, getAlignmentY, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalPolicy, getInsets, getLayout, getMaximumSize, getMinimumSize, getMousePosition, getPreferredSize, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, print, printComponents, processContainerEvent, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusTraversalKeys, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setFont, transferFocusDownCycle, validate, validateTree
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, coalesceEvents, contains, contains, createImage, createImage, createVolatileImage, createVolatileImage, disable, disableEvents, dispatchEvent, enable, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBaseline, getBaselineResizeBehavior, getBounds, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, getGraphicsConfiguration, getHeight, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocation, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getSize, getTreeLock, getWidth, getX, getY, gotFocus, handleEvent, hasFocus, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isDoubleBuffered, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isPreferredSizeSet, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, prepareImage, prepareImage, printAll, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processKeyEvent, processMouseEvent, processMouseMotionEvent, processMouseWheelEvent, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resize, resize, revalidate, setComponentOrientation, setDropTarget, setEnabled, setFocusable, setFocusTraversalKeysEnabled, setForeground, setIgnoreRepaint, setLocale, setMaximumSize, setName, setPreferredSize, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCycle
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
getFont, postEvent
public static final String TOOLBAR_INFO_BUTTON_NAME
public static final String TOOLBAR_PAN_BUTTON_NAME
public static final String TOOLBAR_POINTER_BUTTON_NAME
public static final String TOOLBAR_RESET_BUTTON_NAME
public static final String TOOLBAR_ZOOMIN_BUTTON_NAME
public static final String TOOLBAR_ZOOMOUT_BUTTON_NAME
public JMapFrame()
JMapFrame
with no map content or renderer setpublic JMapFrame(MapContent content)
JMapFrame
object with specified map content.content
- the map contentpublic static void showMap(MapContent content)
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 contentpublic void enableToolBar(boolean enabled)
enableTool(org.geotools.swing.JMapFrame.Tool...)
with all JMapFrame.Tool
constants.enabled
- whether the toolbar is requiredpublic void enableTool(JMapFrame.Tool... tool)
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 toolbarpublic void enableStatusBar(boolean enabled)
enabled
- whether the status bar is required.public void enableLayerTable(boolean enabled)
enabled
- whether the map layer table is required.public void setVisible(boolean state)
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.public void initComponents()
enableToolBar(boolean)
). If not called explicitly by the client this method
will be invoked by setVisible(boolean)
when the frame is first shown.public MapContent getMapContent()
null
if no map content has
been set explicitly with the constructor or setMapContent(org.geotools.map.MapContent)
.MapContent
objectpublic void setMapContent(MapContent content)
content
- the map contentIllegalArgumentException
- if content is nullpublic JMapPane getMapPane()
JMapPane
being used by this frame.JMapPane
objectpublic JToolBar getToolBar()
initComponents()
has not
been called yet this method will invoke it.Copyright © 1996–2019 Geotools. All rights reserved.