private static void constructMapUI(final File shapefile) { JMapFrame frame; MapContent map = new MapContent(); FileDataStore dataStore; SimpleFeatureSource shapefileSource; try { dataStore = FileDataStoreFinder.getDataStore(shapefile); shapefileSource = dataStore.getFeatureSource(); } catch (IOException e) { e.printStackTrace(); return; } Style shpStyle = SLD.createPolygonStyle(Color.RED, null, 0.0f); Layer shpLayer = new FeatureLayer(shapefileSource, shpStyle); map.addLayer(shpLayer); frame = new JMapFrame(map); frame.enableLayerTable(true); frame.setSize(1000, 800); frame.enableStatusBar(true); frame.enableToolBar(true); frame.setTitle("Map Viewer (courtesy of GeoTools"); JMenuBar menuBar = new JMenuBar(); frame.setJMenuBar(menuBar); frame.setVisible(true); frame.setDefaultCloseOperation(JMapFrame.HIDE_ON_CLOSE); }