GeoTools : UseSWT

If you want to build an Eclipse plugin with Geotools, you might need to encapsulate SUN UI libraries into Eclipse compliant ones like SWT.
You need to use the swt-awt-win32-3111 and swt-win32-3111 dll, and also the libraries swingwt.jar and swt.jar in your project in order to be able to use this feature.
The following piece of code show you how you could proceed :

                // a map
		MapContext map = ...
		StyledMapPane mapPane = new StyledMapPane();
		mapPane.setMapContext(map);
		mapPane.getRenderer().addLayer(new RenderedMapScale());
		
                // we use the SWT2AWT bridge provided by Eclipse
		java.awt.Frame locationFrame = SWT_AWT.new_Frame(comp);
		locationFrame.add(mapPane.createScrollPane());
		
                //we build the swt frame
		GridLayout layout = new GridLayout(1, false);
		layout.marginWidth = layout.marginHeight = 0;
		layout.horizontalSpacing = layout.verticalSpacing = 1;
		shell.setLayout(layout);
		GridData data;		
		data = new GridData(GridData.FILL_HORIZONTAL);
		comp.setLayoutData(data);
		data.heightHint = shell.getSize().y;
		shell.open();
		while(!shell.isDisposed()) {
			if (!display.readAndDispatch()) display.sleep();
		}
		display.dispose();